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 / timezone.json
Created June 30, 2014 06:59
timezone gmt list json
[
[
"International Date Line West",
"GMT-11:00",
"(GMT-11:00) International Date Line West"
],
[
"Midway Island",
"GMT-11:00",
"(GMT-11:00) Midway Island"
@ralphcrisostomo
ralphcrisostomo / post.php
Last active December 18, 2016 02:00
Added featured_image property
<?php
// @reference: http://wordpress.org/plugins/json-api/
// @from json-api/models/post.php
class JSON_API_Post {
// Note:
// JSON_API_Post objects must be instantiated within The Loop.
@ralphcrisostomo
ralphcrisostomo / function.php
Last active August 29, 2015 14:01
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…
// 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) {
@ralphcrisostomo
ralphcrisostomo / modernizr-retina-test.coffee
Last active August 29, 2015 13:57
Modernizr test for retina / high resolution / high pixel densitiy
###
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 / Gruntfile.coffee
Created January 6, 2014 04:30
grunt task jasmine server
# ----------
# Jasmine Server
# ----------
grunt.registerTask 'jasmine-server', 'start web server for jasmine tests in browser', ->
grunt.task.run 'jasmine:tests:build'
grunt.event.once 'connect.tests.listening', (host,port) ->
specRunnerUrl = 'http://' + host + ':' + port + '/_SpecRunner.html'
grunt.log.writeln 'Jasmine specs available at: ' + specRunnerUrl
require('open')(specRunnerUrl)
grunt.task.run 'connect:tests:keepalive'
@ralphcrisostomo
ralphcrisostomo / defaults.json
Created December 19, 2013 10:53
copy defaults.json inside .grunt-init directory
{
"author_name": "Ralph Crisostomo",
"author_email": "[email protected]",
"author_url": "http://ralphcrisostomo.net/"
}
# source: http://mashable.com/2013/10/23/clean-install-os-x-mavericks/
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
@ralphcrisostomo
ralphcrisostomo / moom-settings-transfer
Created October 9, 2013 11:34
Moom Settings Transfer
# source: http://macorios.com/blog/2013-2-28-sync-moom-between-two-or-more-macs
# Copy this file to the new mac.
~/Library/Preferences/com.manytricks.Moom.plist.lockfile
@ralphcrisostomo
ralphcrisostomo / Git.Fixed.Untracked.Files
Created July 22, 2013 09:17
Fixed untracked Git files
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
@ralphcrisostomo
ralphcrisostomo / Console.Fix.For.All.Browser.js
Last active December 19, 2015 22:19
Avoid `console` error in browsers that lack a console.
<script type="text/javascript">
// Avoid `console` errors in browsers that lack a console.
if (!(window.console && console.log)) {
(function() {
var noop = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
var length = methods.length;
var console = window.console = {};
while (length--) {
console[methods[length]] = noop;