This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createIframe(id, targetEle, src, content, style){ | |
var iframe = document.createElement('iframe'); | |
(iframe.frameElement || iframe).style.cssText = style || "width: 0; height: 0; border: 0"; | |
iframe.id = id; | |
iframe.src = src || "javascript:false"; | |
$(targetEle).append(iframe); | |
if(src) return iframe; | |
var doc = iframe.contentWindow.document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Movement | |
------------ | |
C-v Move next screen | |
M-v Move backwords one screen | |
C-f Move forward a character | |
C-b Move backward a character | |
M-f Move forward a word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Test Suite</title> | |
<script> | |
(function() { | |
var queue = [], paused = false, results; | |
this.test = function(name, fn) { | |
queue.push(function() { | |
results = document.getElementById("results"); | |
results = assert(true, name).appendChild( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pubsub = {}; | |
(function(q) { | |
var topics = {}, subUid = -1; | |
q.subscribe = function(topic, func) { | |
if (!topics[topic]) { | |
topics[topic] = []; | |
} | |
var token = (++subUid).toString(); | |
topics[topic].push({ | |
token: token, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pluralForms = { | |
"en" : function ( x ) { | |
if ( x === 1 ) { | |
return 0; | |
} | |
return 1; | |
}, | |
"fr" : function ( x ) { | |
if ( x > 1 ) { | |
return 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function execFn( fn ) { | |
var context; | |
// check passed in 'this' a.k.a. 'arguments[0]' & set context | |
context = ( typeof this === "undefined" || typeof this === "null" ) | |
? window | |
: this; | |
// locate 'fn' in 'context' or it's a raw function | |
fn = ( typeof fn === "function" ) | |
? fn | |
: context[fn]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
## Cachefy (jQuery Plugin) | |
## @copyright: 2013 (c) Vishal Telangre <the@vishaltelangre.com> | |
## @license: MIT | |
## @desc: Tiny jQuery plugin to load js files and cache 'em. | |
# | |
# | |
jQuery.cachefy = (url, options) -> | |
# Default settings | |
settings = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# | |
# Establishes connection with a MySQL db and access its tables | |
# which have non-standard names, such as user, accounts. | |
# | |
require 'active_support/inflector' | |
require 'active_record' | |
require 'mysql2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See list of running daemons | |
service --status-all | |
# List of daemons managed by Upstart | |
initctl list | |
# To disable a upstart service | |
echo 'manual' > /etc/init/<service_name>.override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libreoffice --headless --invisible --nologo --convert-to pdf *.html |