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 | |
#{project} | |
#{project}-cli | |
#{project}-db | |
#{project}-job | |
#{project}-web | |
#{project}-config | |
... | |
* We stole the CLI command hierarchy from git. E.g. ./bin/project web (start|stop|status) [options] |
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 | |
# Mysql | |
# | |
# require_once('mysql.php'); | |
# $db = new Mysql(dbname, server, user, pass); | |
# $sth = $db->query('select * from blah where name = ? limit 1', 'fred') || die($db->error()); | |
# while ($row = mysql_fetch_assoc($sth)) | |
# ... | |
# |
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
#pragma once | |
#include <iostream> | |
#include <sstream> | |
#include <string> | |
template<typename T> | |
T string_to(const std::string& p_string) { | |
std::istringstream iss(p_string); | |
T x; |
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 ($) { | |
var providers = {}; | |
/* | |
Given a URL find a provider that can OEmbed the url given. | |
*/ | |
function find (url) { | |
var site = url.match(/^https?:\/\/([^/]+)/)[1]; | |
for (var domain in providers) | |
if (site.indexOf(domain) > -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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.host; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" |
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
require 'delegate' | |
require 'oj' | |
require 'strscan' | |
# JSONPath like access to Oj JSON structs. | |
# | |
# @note Array access is identical to Array#[] | |
class Oj::Path < SimpleDelegator | |
class Error < StandardError; end | |
class MissingError < Error; 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
# First iteration of Ad | |
class Ad | |
attr_accessor :message | |
def view | |
"For sale #{message} call #{owner.name}" | |
end | |
end # Ad |
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
templates: | |
cd web/templates && haml-coffee -i . -n this.nd.templates -o ../js/nd-templates.js | |
css: | |
cd web/css && recess nd.less --compile > ../../public/nd.css | |
app: | |
cd web/app && coffee -cj ../js/nd.js nd.coffee | |
js: |
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
package persona | |
import ( | |
"encoding/json" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
) | |
type Auth struct { |
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
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <mosquitto.h> | |
int main (int argc, char *argv[]) | |
{ | |
bool matches = false; | |
mosquitto_topic_matches_sub(argv[1], argv[2], &matches); | |
printf("matches: %d\n", matches); |