Skip to content

Instantly share code, notes, and snippets.

View tylerthebuildor's full-sized avatar
💭
Hello World!

Tyler tylerthebuildor

💭
Hello World!
View GitHub Profile
@tylerthebuildor
tylerthebuildor / hash.js
Last active February 1, 2016 09:52
Hash CRUD "class" for JavaScript
var HashSearch = new function () {
var params;
this.set = function (key, value) {
params[key] = value;
this.push();
};
this.remove = function (key, value) {
delete params[key];
@tylerthebuildor
tylerthebuildor / linkify.js
Created April 29, 2013 17:50
Turns urls within a block of text into hyperlinks.
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>");
}
@tylerthebuildor
tylerthebuildor / ansi.py
Last active December 16, 2015 15:29
ANSI escape sequences class for coloring bash output.
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 = ''
@tylerthebuildor
tylerthebuildor / deploy.php
Created April 24, 2013 01:06
Automatic deployment script for git
<?php
date_default_timezone_set('America/Los_Angeles');
class Deploy {
/**
* A callback function to call after the deploy has finished.
*
* @var callback
@tylerthebuildor
tylerthebuildor / bash.py
Last active December 16, 2015 10:59
Three different ways to run bash commands.
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)
@tylerthebuildor
tylerthebuildor / ftp.py
Created April 20, 2013 01:16
Comprehensive FTP class
import ftplib
from ftplib import FTP
# Ftp Class
class Ftp:
conn = False
def __init__(self, address, user, password):
self.address = address
self.user = user
@tylerthebuildor
tylerthebuildor / combinations.js
Created April 20, 2013 01:13
All possible combinations of a string.
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);
}