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 combinations(str) { | |
var fn = function(active, rest, a) { | |
if (!active && !rest) | |
return; | |
if (!rest) { | |
a.push(active); | |
} else { | |
fn(active + rest[0], rest.slice(1), a); | |
fn(active, rest.slice(1), a); | |
} |
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
import ftplib | |
from ftplib import FTP | |
# Ftp Class | |
class Ftp: | |
conn = False | |
def __init__(self, address, user, password): | |
self.address = address | |
self.user = user |
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
import subprocess | |
#! /usr/bin/env python | |
import subprocess | |
# Use a sequence of args | |
return_code = subprocess.call(["echo", "hello sequence"]) | |
# Set shell=true so we can use a simple string for the command | |
return_code = subprocess.call("echo hello string", shell=True) | |
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
<?php | |
date_default_timezone_set('America/Los_Angeles'); | |
class Deploy { | |
/** | |
* A callback function to call after the deploy has finished. | |
* | |
* @var callback |
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
class bcolors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
def disable(self): | |
self.HEADER = '' |
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 linkify(text) { | |
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; | |
return text.replace(exp,"<a href='$1'>$1</a>"); | |
} |
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 HashSearch = new function () { | |
var params; | |
this.set = function (key, value) { | |
params[key] = value; | |
this.push(); | |
}; | |
this.remove = function (key, value) { | |
delete params[key]; |
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 syntaxHighlight(json) { | |
if (typeof json != 'string') { | |
json = JSON.stringify(json, undefined, 2); | |
} | |
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | |
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { | |
var cls = 'number'; | |
if (/^"/.test(match)) { | |
if (/:$/.test(match)) { | |
cls = 'key'; |
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 simulateEvent(element, type) { | |
// Check for createEventObject | |
if(document.createEventObject){ | |
// Trigger for Internet Explorer | |
trigger = document.createEventObject(); | |
element.fireEvent('on' + type, trigger); | |
} | |
else { | |
// Trigger for the good browsers | |
trigger = document.createEvent('HTMLEvents'); |
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
// DOM Highlight (Ctrl-i) | |
$(function() { | |
$("<style type='text/css'> .DOMHighlight {background: rgba(0,0,0,0.1);} </style>").appendTo("head"); | |
$('body').keypress(function(e) { | |
if (e.which === 9) | |
$('*').toggleClass('DOMHighlight'); | |
}); | |
})(); |
OlderNewer