Skip to content

Instantly share code, notes, and snippets.

@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@hubgit
hubgit / google-drive-upload-pdf.php
Created April 30, 2012 17:13
Upload a PDF file to Google Drive
<?php
require 'google-api/apiClient.php';
require 'google-api/contrib/apiOauth2Service.php';
require 'google-api/contrib/apiDriveService.php';
$pdfFile = 'test.pdf';
// API Console: https://code.google.com/apis/console/
// Create an API project ("web applications") and put the client id and client secret in config.ini.
@raecoo
raecoo / buttons.css.scss
Created April 26, 2012 08:03
CSS3 Button Styles
@import "css3";
p.button {
margin: 0 0 2em;}
h1.button {
margin: 0;}
a.button {
text-decoration: none;}
@solotimes
solotimes / Rails_new_todo.md
Created April 24, 2012 06:14
Rails new todo
@ayumi
ayumi / stats.rb
Created March 23, 2012 05:20
Better rake:stats for Rails 3.x
# Originally from http://bit.ly/GIhZmg
# modified by @colour to reflect locations of assets in the asset pipeline
namespace :spec do
desc "Add files that DHH doesn't consider to be 'code' to stats"
task :statsetup do
require 'rails/code_statistics'
class CodeStatistics
alias calculate_statistics_orig calculate_statistics
@shanewfx
shanewfx / Markdown Syntax
Created March 10, 2012 02:14
Markdown Syntax
Markdown Syntax:
1.Phrase Emphasis 斜体与加粗
*italic* **bold**
_italic_ __bold__
2.Links 超链接
@WebInspectInc
WebInspectInc / dabblet.css
Created January 20, 2012 21:20
Pure CSS magic line system
/**
* Pure CSS magic line system
* Inspiration: http://css-tricks.com/jquery-magicline-navigation/
* This is a WIP.
*/
a:link, a:visited {
color:black;
text-decoration:none;
}
a:hover ~ .magicline {
@reel
reel / gist:1638094
Created January 19, 2012 05:06
Symfony2 implementation of JQuery Datatables (Working)
<?php
/*
* This class will give us a simple interface to interact with Datatables
*
* Meant to work with Datatables v1.9
*
* DO NOT FORGET TO ADD A GET() METHOD TO YOUR ENTITIES...
*
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@noahhendrix
noahhendrix / api.rb
Created December 22, 2011 09:38
Authenticating with Grape
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end