Skip to content

Instantly share code, notes, and snippets.

View StephenOTT's full-sized avatar
:shipit:
...

Stephen Russett StephenOTT

:shipit:
...
View GitHub Profile
@jlecour
jlecour / gist:978307
Created May 18, 2011 09:55
How MongoDB (Ruby driver) handle Date/DateTime/Time
>> coll.insert({:date => Date.today})
BSON::InvalidDocument: Date is not currently supported; use a UTC Time instance instead.
>> coll.insert({:date => DateTime.now})
BSON::InvalidDocument: DateTime is not currently supported; use a UTC Time instance instead.
>> coll.insert({:date => Time.now}) #=> BSON::ObjectId('4dd39768b98f703261000003')
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@gorenje
gorenje / Gemfile
Created June 8, 2012 11:05 — forked from fairchild/Gemfile
An example sinatra omniauth client app
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
@makotan
makotan / HttpRestVerticle1.java
Created June 14, 2012 09:01 — forked from anonymous/HttpRestVerticle1.java
HttpRestVerticle1 long polling
import java.text.SimpleDateFormat;
import java.util.Date;
import org.vertx.java.core.Handler;
import org.vertx.java.core.http.HttpServer;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.core.http.RouteMatcher;
import org.vertx.java.deploy.Verticle;
public class HttpRestVerticle1 extends Verticle {
@lsolesen
lsolesen / .travis.yml
Created August 13, 2012 11:18
Travis CI-integration for a Drupal 7 installation profile
language: php
php:
- 5.3
mysql:
database: drupal
username: root
encoding: utf8
@zenorocha
zenorocha / README.md
Last active May 28, 2024 08:23
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@dergachev
dergachev / WET-Drupal-WG-Jan25.md
Created January 25, 2013 20:30
Jan 25 WET Drupal Working Group notes

Jan 25 WET Drupal Working Group notes

Drupalcamp Ottawa!

  • http://drupalcampottawa.com/
  • Feb 22 and 23
  • Andrew Hoppin from NYS Senate (keynote)
  • Looking for panelists, speakers.
  • Expecting 200+ people on the Friday, (first day)
@rauluranga
rauluranga / cloneReposFromFile.sh
Created January 30, 2013 18:35
Clone multiples git repositories from text file.
#!/bin/bash
for LINE in `cat "$1"`; do
echo 'start cloning repo:' : $LINE;
git clone $LINE
done
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@kimmobrunfeldt
kimmobrunfeldt / node-exports-styles.js
Last active July 1, 2023 18:39
A few Node module export styles. 1 seems to be the most used and I prefer it
// Style 1
// Export all manually
// Good: Calling functions inside the module is convenient
// Bad: module.exports becomes verbose and it's tedious to add new functions
function a() {
b()
}