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 | |
$field = "field"; | |
$hasField = false; | |
$table = "table"; | |
$connect = @mysql_connect("host","username","password"); | |
if (!$connect) echo "Server error: CONN"; | |
$select_db = mysql_select_db("database"); | |
if (!$select_db) echo "Server error: DB"; | |
$result = mysql_query("SHOW COLUMNS FROM $table"); | |
while ($row = mysql_fetch_array($result)) |
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
#!/bin/bash | |
USER="$1" | |
PASS="$2" | |
DB="$3" | |
if [ $# -ne 3 ] | |
then | |
echo "Usage: $0 {MySQL-User-Name} {MySQL-User-Password} {MySQL-Database-Name}" | |
echo "Drops all tables from a MySQL" | |
exit 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
#!/usr/bin/env ruby | |
############################################################################### | |
# Required Application Libraries # | |
############################################################################### | |
%w{ rubygems optparse ostruct socket yaml }.each { |lib| require lib } | |
############################################################################### | |
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
# FSM Simulation | |
edges = { | |
[1, 'a'] => 2, | |
[2, 'a'] => 2, | |
[2, '1'] => 3, | |
[3, '1'] => 3 | |
} | |
accepting = [3] |
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
do () -> | |
namespacer = (ns, obj) -> | |
if not typeof ns == "string" or not ns.length | |
throw new Error '[namespacer] Invalid namespace' | |
namespace = @ | |
namespace = namespace[part] = namespace[part] or {} for part in ns.split '.' | |
namespace[attr] = obj[attr] for attr of obj if typeof obj == 'object' | |
namespace | |
@['namespacer'] = @['ns'] = namespacer |
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 | |
# Ruby implementation of the python Cache class from Box CRE "The 'One' Thing" by Peter Potrebic | |
$store = {} | |
$namespace = 'rcache' | |
class Cache < Object | |
def initialize(cache_name) |
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
store = {} | |
store.setdefault = (key, def) -> | |
@[key] = def unless @[key] | |
@[key] | |
namespace = 'pcache' | |
formatKey = -> | |
[].slice.call(arguments).join '.' |
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
module Nvidia | |
class LinkHelper < Liquid::Tag | |
Link = Struct.new :classes, :href, :id, :local, :name | |
def initialize(tagName, markup, tokens) | |
super | |
end | |
def hash_to_link link | |
Link.new link.fetch('classes'), link.fetch('href'), link.fetch('id'), link.fetch('local'), link.fetch('name') |
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
def titlize(the_title) | |
system("echo '#{the_title.downcase.gsub!(' ', '-')}' | pbcopy") | |
end |
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/ruby | |
def factorial n | |
f = n | |
for i in (n - 1).downto(1) | |
f *= i | |
i -= 1 | |
end | |
return f | |
end |