Skip to content

Instantly share code, notes, and snippets.

Ralf Crisostomo ralphcrisostomo

Block or report user

Report or block ralphcrisostomo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ralphcrisostomo
ralphcrisostomo / modernizr-retina-test.coffee
Last active Aug 29, 2015
Modernizr test for retina / high resolution / high pixel densitiy
View modernizr-retina-test.coffee
###
Modernizr test for retina / high resolution / high pixel density
@ref https://gist.github.com/joaocunha/7675924
@author Joao Cunha
@license MIT
###
Modernizr.addTest 'hires', ->
# starts with default value for modern browsers
@ralphcrisostomo
ralphcrisostomo / function.php
Last active Aug 29, 2015
I would have done it as following, I am sure experts here will have a better way but following is what I could come up with in hurry. First create your controller file in your theme directory (or any other if you like) with the following content. For this example the file name is korkmaz.php UPDATE 1: Please replace the previous korkmaz.php beca…
View function.php
// Add a custom controller
add_filter('json_api_controllers', 'add_my_controller');
function add_my_controller($controllers) {
$controllers[] = 'Korkmaz';
return $controllers;
}
// Register the source file for our controller
add_filter('json_api_korkmaz_controller_path', 'korkmaz_controller_path');
function korkmaz_controller_path($default_path) {
View countries.json
[
[
"Afghanistan",
"AF"
],
[
"Aland Islands",
"AX"
],
[
View .gitignore_global
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store?
ehthumbs.db
@ralphcrisostomo
ralphcrisostomo / render_partial.haml
Last active Aug 29, 2015
Outside rails, a partial render function inside haml file.
View render_partial.haml
-# --------------------
-# RENDER PARTIAL FUNCTION
-# Render function inside haml file
-# --------------------
- def render(partial) Haml::Engine.new(File.read("app/templates/#{partial}")).render end
@ralphcrisostomo
ralphcrisostomo / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ralphcrisostomo
ralphcrisostomo / javascript_resources.md
Last active Aug 29, 2015 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
View ember-learning-notes.md

Ember Learning Notes

Tips

  • Use Invoke to run a method on every object in an array

      collection.invoke('set','isSelected', true);
    

Ember

View git_tips.md

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo
@ralphcrisostomo
ralphcrisostomo / Node Learning Notes.md
Last active Aug 29, 2015
Express.js Learning Notes
View Node Learning Notes.md

Express.js Learning Notes

Tips

  • Always refer to http://expressjs.com/api.html
  • Everything is “middleware”.
  • use means “Run this on ALL requests”
  • get means “Run this on a GET request, for the given URL”
  • in between middleware should return next() or res.end()
  • Ends the response process.
You can’t perform that action at this time.