Skip to content

Instantly share code, notes, and snippets.

View ralphcrisostomo's full-sized avatar

Ralf Crisostomo ralphcrisostomo

  • Goodstuff
  • Australia
View GitHub Profile
@ralphcrisostomo
ralphcrisostomo / handlebars_with_backbone_collection.js
Created August 14, 2012 09:19
using handlebars with backbone block collection
// Reference:
// http://stackoverflow.com/questions/7344982/questions-on-backbone-js-with-handlebars-js
var ArticleListView = Backbone.View.extend({
el: $('#main'),
render: function(){
var js = this.collection.toJSON();
var template = Handlebars.compile($("#some-template").html());
$(this.el).html(template({articles: js}));
return this;
@ralphcrisostomo
ralphcrisostomo / print_object_in_javascript.js
Created July 20, 2012 00:43
Print Objects in Javascript
/**
Print Objects in Javascript
*/
var output = '';
for (property in object) {
output += property + ': ' + object[property]+'; ';
}
console.log(output);
@ralphcrisostomo
ralphcrisostomo / array_dupplicate_counter.js
Created July 19, 2012 07:43
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@ralphcrisostomo
ralphcrisostomo / Wordpress Localhost FTP Connection Information.md
Last active October 26, 2020 14:27
Bypass Wordpress Localhost FTP Connection Information

Bypass Wordpress Localhost FTP Connection Information

Do chown / chmod wordpress folder:

    $ sudo chown -R :_www wordpress
    $ sudo chmod -R g+w wordpress

Add the following line into wp-config.php:

@ralphcrisostomo
ralphcrisostomo / gist:3088892
Created July 11, 2012 08:15 — forked from killerbytes/gist:3050623
Javascript: delay
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
@ralphcrisostomo
ralphcrisostomo / gist:2631889
Created May 8, 2012 01:37
backbone fetch supports Jquery.ajax parameters
// Sample Code
// backbone fetch supports Jquery.ajax parameters
Model.fetch( {
data: {api_key: 'secretkey'},
type: 'POST',
success: function(model, response) {
console.log('SUCCESS:');
console.log(response);