Skip to content

Instantly share code, notes, and snippets.

View infacq's full-sized avatar

Muhaimin infacq

  • Seri Kembangan, Selangor Malaysia
View GitHub Profile
@infacq
infacq / pembilang
Created November 7, 2013 05:10
Teknik pembilang dalam TABLE menggunakan CSS
table { counter-reset: line-number; }
tbody > tr > td:first-child:before {
content: counter(line-number) ".";
counter-increment: line-number;
padding-right: 0.3em;
}
@infacq
infacq / Twitter Bootstrap Radio Button Form Inputs.html
Last active December 26, 2015 17:59 — forked from canuk/Twitter Bootstrap Radio Button Form Inputs.html
another clean way getting value from hidden input radio when using Twitter Bootstrap 3
<form>
<div class="btn-group" data-toggle-name="is_private" data-toggle="buttons" >
<label class="btn btn-default">
<input type="radio" name="private" value="1"> Yes
</label>
<label class="btn btn-default">
<input type="radio" name="private" value="0"> No
</label>>
</div>
<input type="hidden" name="is_private" value="0" />
@infacq
infacq / _.after
Created October 22, 2013 03:00
1) setup pemboleh ubah lokal yang ditugas kepada fungsi _.after 2) panggil pemboleh ubah tadi ke dalam gelung _.each selepas pelaksanaan _.each telah lengkap, maka _.after akan berjalan seperti patutnya
var renderPoin = _.after(data.models.length, function() {
// lakukan sesuatu disini
});
@infacq
infacq / setup collection
Last active December 26, 2015 04:39
sampel guna backboneJS
window.Zoo = Backbone.Collection.extend({
model:Makhluk,
url:"./api/makhluk",
initialize: function() {
this.deferred = this.fetch();
}
});
RouterKu = Backbone.Router.extend({
routes: {
"sini/sana" : "bertindak"
},
bertindak: function(){
// lakukan sesuatu disini
}
});
window.LoginView = new LoginView({model: new Pembenaran()});
events: {
"click #login": "login"
}
@infacq
infacq / el
Created October 11, 2013 08:36
el: $("#login-form")
@infacq
infacq / borang
Last active December 25, 2015 06:19
<form action="/login" id="login-form">
Nama pengguna: <input type="text" id="nPengguna"><br>
Kata Laluan: <input type="password" id="kLaluan"><br>
<button id="login">Masuk</button>
</form>
var modelKu = Backbone.Model.extend({});
modelDia = new modelKu();
modelDia.bind("change", function(model, collection){
alert("ada perubahanlah: " + model.get('some_attribute'));
});
modelDia.set({some_attribute: "nilai untuk sesuatu"});