Skip to content

Instantly share code, notes, and snippets.

Avatar

Ralf Crisostomo ralphcrisostomo

  • Goodstuff
  • Australia
View GitHub Profile
@ralphcrisostomo
ralphcrisostomo / gist:2631889
Created May 8, 2012
backbone fetch supports Jquery.ajax parameters
View gist:2631889
// 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);
View gist:3088892
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
@ralphcrisostomo
ralphcrisostomo / Wordpress Localhost FTP Connection Information.md
Last active Oct 26, 2020
Bypass Wordpress Localhost FTP Connection Information
View Wordpress Localhost FTP Connection Information.md

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 / array_dupplicate_counter.js
Created Jul 19, 2012
Javascript: Count duplicates in an array
View array_dupplicate_counter.js
/**
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.
*/
View print_object_in_javascript.js
/**
Print Objects in Javascript
*/
var output = '';
for (property in object) {
output += property + ': ' + object[property]+'; ';
}
console.log(output);
@ralphcrisostomo
ralphcrisostomo / handlebars_with_backbone_collection.js
Created Aug 14, 2012
using handlebars with backbone block collection
View handlebars_with_backbone_collection.js
// 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;
View insetTopShadowOnly.scss
// Inset, Top Shadow Only
@include box-shadow(inset 0 1px 1px -1px black);
@ralphcrisostomo
ralphcrisostomo / flexbox_layout.html
Created Aug 17, 2012
The classic 3 column layout. Notice the navigation appearing first, also note that the background colour extends to the full height of all boxes.
View flexbox_layout.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>flexbox example - 3 column layout</title>
<meta name="author" content="Gwilym Johnston">
<link rel="stylesheet" href="base.css" type="text/css" media="screen">
<style type="text/css">
.flexbox {
@ralphcrisostomo
ralphcrisostomo / center-element.scss
Created Aug 17, 2012
Center an element absolutely and relatively
View center-element.scss
/**
author: Ralph Crisostomo
*/
@mixin center-element($width, $height) {
width:$width;
height:$height;
position: absolute;
top: 50%;
left: 50%;
@ralphcrisostomo
ralphcrisostomo / stretchToFit.scss
Created Aug 23, 2012
stretch to fit on window size
View stretchToFit.scss
.div {margin:10px; position:absolute; top:0; left:0; right:0; bottom:0}