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 lob | |
lob.api_key = 'YOUR_KEY' | |
api_version = 'v1' | |
api_url = 'https://api.lob.com/{version}/'.format(version=api_version) | |
####################################################################################################################### | |
def get_setting_int(description): | |
pc_setting_dict = {"4x6":1001, |
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 | |
use Guzzle\Http\Client; | |
use Guzzle\Http\EntityBody; | |
use Guzzle\Http\Message\Request; | |
use Guzzle\Http\Message\Response; | |
class Lob { | |
private $base_url = 'https://api.lob.com/v1/'; |
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
use std::hashmap::HashMap; | |
fn main() { | |
let (encode_dict, decode_dict) = build_dict(); | |
let uncompressed = ~"I like hot dogs"; | |
let compressed = compress(uncompressed, encode_dict); | |
println!("{:?}", compressed); | |
let decompressed = decompress(compressed, decode_dict); |
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
fn main() { | |
let max: uint = 25; | |
let results = fibonacci(max, ~[]); | |
for i in results.iter() { | |
println!("{}", i.to_str()); | |
} | |
} | |
fn fibonacci(max: uint, mut list: ~[int]) -> ~[int] { |
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
fn main() { | |
let distance = levenshtein("brian", "seitel"); | |
println!("{}", distance); | |
} | |
/* | |
Calculate the levenshtein distance between two strings. | |
@param first - | |
*/ | |
fn levenshtein(first: &str, second: &str) -> uint { |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/> | |
<script src="http://cmx.io/v/0.1/cmx.js"></script> | |
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style> | |
<body> | |
<div style="max-width:900px; -webkit-transform:rotate(0deg);"> | |
<scene id="scene1"> | |
<label t="translate(0,346)"> |
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
# To use: | |
# | |
# erma = ermagerd("oh my god, a refrigerator1") | |
import re | |
class ermagerd: | |
def __init__(self, arg1): | |
print self.gherd(arg1) |
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 TMDB { | |
const VERSION = 3; | |
const BASE_URL = 'api.themoviedb.org'; | |
protected static $api_key = ''; | |
public function __construct($api_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 simplexml_to_array($simplexml_object, &$array) { | |
$children = $simplexml_object->children(); | |
$executed = false; | |
foreach ($children as $elementName => $node) { | |
if ($array[$elementName] != null) { | |
if ($array[$elementName][0] !== null) { | |
$i = count($array[$elementName]); | |
simplexml_to_array($node, $array[$elementName][$i]); | |
} else { | |
$tmp = $array[$elementName]; |
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 flatten_array($array, $return = array(), $main_key = '') { | |
if ($main_key) | |
$main_key = $main_key.'_'; | |
foreach ($array as $k => $item) { | |
if (is_array($item)) | |
$return = self::flatten_array($item, $return, $main_key.$k); | |
else { | |
$new_key = $main_key.$k; | |
$return[$main_key.$k] = $item; |