Skip to content

Instantly share code, notes, and snippets.

@jamak
jamak / app.go
Last active August 29, 2015 14:17
package main
import (
// "os"
"fmt"
"github.com/stianeikeland/go-rpio"
"log"
"net/http"
// "sync"
"time"
@Jxck
Jxck / rob.go
Last active November 17, 2022 20:34
gocon 2014
type errWriter struct {
w io.Writer
err error
}
func (e *errWriter) Write(p []byte) {
if e.err != nil {
return
}
_, e.err = e.w.Write(p)
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"

Testing OAuth Apis in rails 3.x apps

  1. Install phantomjs
  2. Add rspec, poltergeist, capybara, vcr to Gemfile
  3. bundle install
  4. Create spec/acceptance folder
  5. Create spec/acceptance/acceptance_helper.rb (see below)
  6. Create spec for oauth flow (see below) read the comments carefully

NB: My signup flow is something like:

@enjalot
enjalot / index.html
Created September 8, 2011 15:15
Simple Pie Chart example with D3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">