Skip to content

Instantly share code, notes, and snippets.

@wesbillman
wesbillman / in_this_language.md
Last active April 21, 2017 14:31 — forked from jamiehs/in_this_language.md
In This Language (add your comments or suggestions)

Input

foo bar baz qux

Required Output

Hello Foo
Hello Bar
Hello Baz
Hello Qux
@wesbillman
wesbillman / gist:8672903
Created January 28, 2014 18:04
lol setup
//install dependencies
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
//install rbenv
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
[color]
ui = true
[alias]
st = status
c = commit -m
a = add
aa= !git add -u && git add . && git status
co = checkout
cob = checkout -b
up = !git fetch origin && git rebase origin/master
@wesbillman
wesbillman / AppDelegate.m
Created November 2, 2012 18:20
SVHTTPClient
- (void)setupSVHTTPClient
{
[[SVHTTPClient sharedClient] setValue:@"test" forHTTPHeaderField:@"Client"];
[[SVHTTPClient sharedClient] setValue:@"373e606658a8b539dfeeecac7f10ad33078e2ba15a80d5686ae2" forHTTPHeaderField:@"Secret"];
[[SVHTTPClient sharedClient] setBasePath:@"https://server.com/api"];
[[SVHTTPClient sharedClient] setSendParametersAsJSON:YES];
}
{
"album_order" = "{\"count\":3,\"album_order\":{\"36\":{\"zebra\":\"zebra\"},\"count\":3,\"album_order\":{\"35\":{\"album\":\"album\"},\"count\":\"1\",\"album_order\":{\"0\":{\"album_id\":\"34\",\"name\":\"from ios\",\"url_name\":\"from-ios\"}}}}}";
email = "wes.billman@gmail.com";
id = 2;
layout = tiled;
name = "Wes Billman";
"site_name" = wes;
"site_url" = wes;
theme = light;
}
emails don't match
email already taken
email not valid
email and password don't match
you must accept terms
email not found
password too short
you have already bought this video
you have already rented this video
<?php
function convert_state($name, $to='name') {
$states = array(
array('name'=>'Alabama', 'abbrev'=>'AL'),
array('name'=>'Alaska', 'abbrev'=>'AK'),
array('name'=>'Arizona', 'abbrev'=>'AZ'),
array('name'=>'Arkansas', 'abbrev'=>'AR'),
array('name'=>'California', 'abbrev'=>'CA'),
array('name'=>'Colorado', 'abbrev'=>'CO'),
array('name'=>'Connecticut', 'abbrev'=>'CT'),
<?php
function get_image_from_content($content) {
// Define the pattern to search
$szSearchPattern = '~<img [^\>]*\ />~';
// Run preg_match_all to grab all the images and save the results in $aPics
preg_match_all( $szSearchPattern, $content, $aPics );
// Count the results
$iNumberOfPics = count($aPics[0]);
function sss_excerpt($string, $count, $string_tags = TRUE){
//it's blank, just return.
if ( '' == $string) return $string;
$string = str_replace(']]>', ']]&gt;', $string);
$string = strip_tags($string);
$words = explode(' ', $string, $count + 1);
if (count($words)> $count) {
array_pop($words);
$string = implode(' ', $words);
#include "sm.h"
static state_e current_state;
static void state_a_entry(void);
static void state_a_exit(void);
static void message_a_handler(void);
static void message_b_handler(void);
static void message_c_handler(void);
static const state_t state_list[] =