Skip to content

Instantly share code, notes, and snippets.

:: Installation
:: ------------
::
:: 1. Add this to the same directory as the Google Closure Compiler jar
:: 2. Add that directory to your Windows PATH environment variable
::
:: Then simply run the compiler, for example:
::
:: compiler --js input.js --js_output_file output.min.js
::
/*
* SyncUrlProtocol - Underscore/Lodash mixin for sync url protocol with window url protocol
*
* Copyright (c) 2013 Antonio Rodríguez Ruiz
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
* http://outbook.es
/*
* GetChildrenTextNodes - jQuery plugin for children text nodes
*
* Copyright (c) 2013 Antonio Rodríguez Ruiz
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
* http://outbook.es
/*
* SliceAnchor - jQuery plugin for fake anchors
*
* Copyright (c) 2012 Antonio Rodríguez Ruiz
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
* http://outbook.es
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
@jervert
jervert / APPNAME
Created December 19, 2013 13:14 — forked from eculver/APPNAME
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@jervert
jervert / function.sliceTemplate.php
Created December 29, 2013 18:57
Execute PHP template from file and return the result as a string
<?php
/*
* SliceTemplate - Execute PHP template from file and return the result as a string
*
* Copyright (c) 2013 Antonio Rodríguez Ruiz
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
@jervert
jervert / isLeapYear.js
Created January 9, 2014 14:03
Hypersimple leap year verify for Javascript
function isLeapYear(year) {
return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
}
@jervert
jervert / gist:96b73589026daed56e5e
Created November 20, 2015 07:47
Remove view from Backbone without remove view element
removeView = function(view) {
view.undelegateEvents();
view.$el.empty().off();
view.unbind();
}
<p role="link" tabindex="0" data-link>Link by role</p>
<p role="button" tabindex="0" data-button>Button by role</p>
<script>
const EVENT_CLICK = 'click';
const EVENT_KEYBOARD = 'keypress';
const EVENTS_CLICK = [EVENT_CLICK, EVENT_KEYBOARD];
const KEY_ENTER = 13;
const KEY_ESPACE = 32;
const KEYS_BUTTON = [KEY_ENTER, KEY_ESPACE];