Wednesday, June 29, 2016
Sunday, June 26, 2016
Meteor shortcuts
Meteor is a framework that speeds up web development.
Before we start:
Install Sublime (recommended editor)
Install Cmder (recommended command prompt)
Create new app
Cmder:
meteor create simple-todos
cd simple-todos
meteor npm install
meteor
Browser:
http://localhost:3000
File:
Open folder > simple-todos
Best Practices (my own)
Create a template
<template>... </template>
Call a template
{{>templateName}}
Import all JS using the main JS file
Sublime: /client/main.js
Add logic or data
DISPLAY COLLECTION OF DATA
JS file:
Template.body.helpers({
mybunch: [
{ mysentence: 'This is task 1x' },
{ mysentence: 'This is task 2' },
{ mysentence: 'This is task 3' },
],
});
HTML file:
<ul>
{{#each mybunch}}
{{> mytemplate1}}
{{/each}}
</ul>
<template name="mytemplate1">
<li>{{mysentence}}</li>
</template>
FORM WITH RESPONSIVE BUTTONS
HTML file:
<template name="mytemplate2">
<li class="{{#if checked}}checked{{/if}}">
<button class="delete">×</button>
<input type="checkbox" checked="{{checked}}" class="toggle-checked" />
<span class="text">{{text}}</span>
</li>
</template>
JS File: (use event listener "template.task.events" to listen for the event "click" located in css tag "toggle-checked"; when triggered, it UPDATE into the "Tasks" collection)
CREATE A DATABASE
Sublime: /imports/tasks.js
import { Mongo } from 'meteor/mongo';
export const Tasks = new Mongo.Collection('tasks');
Server must import: /server/main.js
ADD ENTRY TO DATABASE MANUALLY
Cmder:
meteor mongo
db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
ADD FORM
HTML File:
SHOW NEWEST TASK AT THE TOP:
return Tasks.find({}, { sort: { createdAt: -1 } });
Open folder > simple-todos
Best Practices (my own)
- Different modules for different sections of website e.g. head, body, footer
- Each module has a file for its look (html) and a file for what it does (js) e.g. body.html, body.js
- Load sequence: main.js --> [others].js --> [others].html
Create a template
<template>... </template>
Call a template
{{>templateName}}
Import all JS using the main JS file
Sublime: /client/main.js
import '../imports/ui/body.js';
Add logic or data
{{#each}} ...{{/each}} and {{#if}}...{{/if}}DISPLAY COLLECTION OF DATA
JS file:
Template.body.helpers({
mybunch: [
{ mysentence: 'This is task 1x' },
{ mysentence: 'This is task 2' },
{ mysentence: 'This is task 3' },
],
});
HTML file:
<ul>
{{#each mybunch}}
{{> mytemplate1}}
{{/each}}
</ul>
<template name="mytemplate1">
<li>{{mysentence}}</li>
</template>
FORM WITH RESPONSIVE BUTTONS
HTML file:
<template name="mytemplate2">
<li class="{{#if checked}}checked{{/if}}">
<button class="delete">×</button>
<input type="checkbox" checked="{{checked}}" class="toggle-checked" />
<span class="text">{{text}}</span>
</li>
</template>
JS File: (use event listener "template.task.events" to listen for the event "click" located in css tag "toggle-checked"; when triggered, it UPDATE into the "Tasks" collection)
Template.task.events({
'click .toggle-checked'() {
// Set the checked property to the opposite of its current value
Tasks.update(this._id, {
$set: { checked: ! this.checked },
});
},
});
HTML file:<template name="mytemplate2"><li class="{{#if checked}}checked{{/if}}"><button class="delete">×</button><input type="checkbox" checked="{{checked}}" class="toggle-checked" /><span class="text">{{text}}</span></li></template>
Template.task.events({
'click .delete'() {
Tasks.remove(this._id);
},
});
CREATE A DATABASE
Sublime: /imports/tasks.js
import { Mongo } from 'meteor/mongo';
export const Tasks = new Mongo.Collection('tasks');
Server must import: /server/main.js
import '../imports/api/tasks.js';
Client must import: /imports/body.jsimport { Tasks } from '../api/tasks.js';
Template.body.helpers({
tasks() {
return Tasks.find({});
},
});
ADD ENTRY TO DATABASE MANUALLY
Cmder:
meteor mongo
db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
ADD FORM
HTML File:
<form class="new-task">
<input type="text" name="text" placeholder="Type to add new tasks" />
</form>
JS File: (use event listener "template.body.events" to listen for the event "submit" located in css tag "new-task"; when triggered, it INSERT into the "Tasks" collection)Template.body.events({
'submit .new-task'(event) {
// Prevent default browser form submit
event.preventDefault();
// Get value from form element
const target = event.target;
const text = target.text.value;
// Insert a task into the collection
Tasks.insert({
text,
createdAt: new Date(), // current time
});
// Clear form
target.text.value = '';
},
});
SHOW NEWEST TASK AT THE TOP:
return Tasks.find({}, { sort: { createdAt: -1 } });
Thursday, June 2, 2016
How to see Wifi Password on Windows 10
1. From the Start screen, swipe in from the right edge of the screen, and tap Settings.
2. Tap or click wireless network .
3. Tap and hold or right click on a wireless network name, and choose View connection properties.
4. Select Show characters to see the wireless network password.
2. Tap or click wireless network .
3. Tap and hold or right click on a wireless network name, and choose View connection properties.
4. Select Show characters to see the wireless network password.
Monday, May 2, 2016
How to remove programs from loading on starting up Windows 7
1. Windows+R
2. msconfig
3. Startup tab > untick the unwanted programs
4. Apply > OK
2. msconfig
3. Startup tab > untick the unwanted programs
4. Apply > OK
Saturday, April 30, 2016
How to Pay MBPJ Summons Online with a Discount
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
For an updated version, please click on this link
http://hacks-for-life.blogspot.my/2016/10/how-to-pay-mbpj-summons-with-discount.html
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Go to
Login at http://eps.mbpj.gov.my/LoginPengguna.aspx
Go to http://www.mbpj.gov.my/e-perkhidmatan
http://eps.mbpj.gov.my/index.aspx
Login to https://pgateway.mbpj.gov.my/bills/search
Hit Carian
Search for Kemudahan (Trafik dan Pelbagai)
Under No Kompaun, type in your compound number
Hit "Cari"
Tick the compounds which belong to you, then hit "Tambah di Senarai" to add it to tag it to your profile
Repeat if necessary to tag all other compounds to your profile
Hit Bayaran
Tick all the compounds you wish to pay, then hit "Bayar" button
Hit the Kad Kredit button (the only payment method available)
Make the payment (e.g. CIMB Clicks)
Go to Rekod Transaksi
Click on the relevant transaction to view details and print receipt
For an updated version, please click on this link
http://hacks-for-life.blogspot.my/2016/10/how-to-pay-mbpj-summons-with-discount.html
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Go to
Login at http://eps.mbpj.gov.my/LoginPengguna.aspx
Go to http://www.mbpj.gov.my/e-perkhidmatan
http://eps.mbpj.gov.my/index.aspx
Login to https://pgateway.mbpj.gov.my/bills/search
Hit Carian
Search for Kemudahan (Trafik dan Pelbagai)
Under No Kompaun, type in your compound number
Hit "Cari"
Tick the compounds which belong to you, then hit "Tambah di Senarai" to add it to tag it to your profile
Repeat if necessary to tag all other compounds to your profile
Hit Bayaran
Tick all the compounds you wish to pay, then hit "Bayar" button
Hit the Kad Kredit button (the only payment method available)
Make the payment (e.g. CIMB Clicks)
Go to Rekod Transaksi
Click on the relevant transaction to view details and print receipt
Tuesday, March 22, 2016
Attention Car Drivers: Don't Ever Be Involved In an Accident with a Motorcyclist In Malaysia
If you have been unfortunate enough to have been involved in an accident with a motorcyclist while driving a car in Malaysia, then you'll no doubt take a dip into the dark side of the insurance industry here.
Noticed that there has been no mention of who is at fault.
It doesn't matter if you knocked into the motorcyclist, or if the motorcyclist knocked into your car. As long as you drive a car, you're gonna get hit financially.
The law enables motorcyclists up to 6 years to claim up to RM10,000 for bodily injury.
Note: This applies not just to motorcyclists, but to taxies and pedestrians in Malaysia as well.
"3rd ranked" lawyers know this and approach motorcylists at accident sites or in hospitals, offering to help them. One claims officer said that such lawyers may offer such services, charging by taking up to 70% of the awarded amount while giving 30% to the motorcyclist. They know how to paint a convincing picture of victimisation, claiming the motorcyclist as the sole breadwinner, and lost ability to work. Both parties win at the expense of the car driver.
The car driver faces a dilemma. Should he claim against the motorcyclist for damages to his car, and risk the motorcyclist counterclaim against his insurance resulting in loss of NCB and higher future insurance cost? Or should he claim against his own insurance policy to pay for his car damages, and still be subject to chance of claim filed by motorcyclist against his insurance?
Motor insurance claims staff share stories where at least 5 in 10 motorcyclists will opt for this claim.
The only consolation for car drivers is that they can claim back the increase in extra insurance paid for loss of NCB after 6 years, provided the motorcyclist did not claim for bodily injury and the car involved has not be sold.
Noticed that there has been no mention of who is at fault.
It doesn't matter if you knocked into the motorcyclist, or if the motorcyclist knocked into your car. As long as you drive a car, you're gonna get hit financially.
The law enables motorcyclists up to 6 years to claim up to RM10,000 for bodily injury.
Note: This applies not just to motorcyclists, but to taxies and pedestrians in Malaysia as well.
"3rd ranked" lawyers know this and approach motorcylists at accident sites or in hospitals, offering to help them. One claims officer said that such lawyers may offer such services, charging by taking up to 70% of the awarded amount while giving 30% to the motorcyclist. They know how to paint a convincing picture of victimisation, claiming the motorcyclist as the sole breadwinner, and lost ability to work. Both parties win at the expense of the car driver.
The car driver faces a dilemma. Should he claim against the motorcyclist for damages to his car, and risk the motorcyclist counterclaim against his insurance resulting in loss of NCB and higher future insurance cost? Or should he claim against his own insurance policy to pay for his car damages, and still be subject to chance of claim filed by motorcyclist against his insurance?
Motor insurance claims staff share stories where at least 5 in 10 motorcyclists will opt for this claim.
The only consolation for car drivers is that they can claim back the increase in extra insurance paid for loss of NCB after 6 years, provided the motorcyclist did not claim for bodily injury and the car involved has not be sold.
Wednesday, March 2, 2016
Getting Dog Licence in Klang Valley
If you have dogs in your care and stay in the Klang Valley, then you need to obtain a licence for your canine friends. The easiest way is to print a form which is available online, then bring the form to your nearest DBKL counter to make payment and receive the dog tag.
1. Go to http://edog.dbkl.gov.my/
2. Create your account
3. Fill in all required details
4. Print out the form
5. Bring to form to any DBKL outlet to make your payment and receive the dog tag
1. Go to http://edog.dbkl.gov.my/
2. Create your account
3. Fill in all required details
4. Print out the form
5. Bring to form to any DBKL outlet to make your payment and receive the dog tag
Subscribe to:
Posts (Atom)
Popular Posts
-
Editor's Note: This post was originally published in October 2016 and has been completely revamped and updated for accuracy and compr...
-
This article shows you TWO (2) ways to save money: How to get discounts when you pay your MBPJ summons; and How to save more money when...
-
Normal dist - big changes from mean are uncommon Fat-tail dist - exists in financial markets, where big changes (from mean) have hi probabil...
-
You own a Proton Saga BLM and one day when you turn the ignition key, the car doesn't start as usual. Instead, the engine coughs and t...
-
1. To convert your Python Kivy app (.py) to an Android (.apk) file , you need Linux on your Windows 10 PC Windows10 > Control Panel ...
-
Why? Cheap, consumes little power, generates little heat/noise. Protected from external attacks because accessible only thru local wifi (by ...
-
How to export image with a transparent background 1. Add a new canvas: Tap "+" sign at top right to add New canvas > 3000x300...
-
The main driver file for HP LaserJet Pro M12w is "hp_LJPM11-M13_Full_Solution-v20180815-10229428.exe". If running it just results ...
-
To check and pay your DBKL summons online, there are several ways depending on the information you have with you: If you have VEHICLE NUM...
-
Eye of the Sahara https://www.google.com/maps/place/Richat+Structure/@21.0430669,-12.1300028,286500m/data=!3m1!1e3!4m6!3m5!1s0xe811f4e324b68...

















