Skip to content

Instantly share code, notes, and snippets.

@mazuhl
mazuhl / application_controller.rb
Created Jan 8, 2010
Putting together a traffic analytics model and controller for a Ruby on Rails app based on this presentation about Scribd http://www.scribd.com/doc/49575/Scaling-Rails-Presentation-From-Scribd-Launch (see slides 17 to 22).
View application_controller.rb
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
before_filter :log_page_view, :except => [:destroy]
private
@mattetti
mattetti / gist:1318670
Created Oct 27, 2011
google cloud print pointers
View gist:1318670
client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET,
:authorize_url => "/o/oauth2/auth",
:access_token_url => "/o/oauth2/token",
:site => 'https://accounts.google.com/')
get '/auth' do
url = client.web_server.authorize_url(
:redirect_uri => redirect_uri,
:scope => 'https://www.googleapis.com/auth/cloudprint',
:response_type => "code"
@czivko
czivko / vendor-ffmpeg-x264-mp3lame-heroku
Last active Dec 10, 2015 — forked from coopermaruyama/vendor-ffmpeg-heroku
How to compile ffmpeg with h264 and mp3 encoders enabled for use on heroku.
View vendor-ffmpeg-x264-mp3lame-heroku
## Get FFMpeg working on heroku by building binaries using vulcan
# also added instructions on how to compile with libmp3lame and libx264
gem install vulcan
vulcan create foo
#clone the app vulcan just created
git clone git@heroku.com:foo
@brainix
brainix / install_do_postgres.sh
Last active Jan 3, 2016
Install the do_postgres gem with Postgres.app
View install_do_postgres.sh
gem install do_postgres -- \
--with-pgsql-server-dir=/Applications/Postgres.app/Contents/Versions/9.3 \
--with-pgsql-server-include=/Applications/Postgres.app/Contents/Versions/9.3/include/postgresql/server
@jhollinger
jhollinger / dropbox.css
Created Jul 27, 2012
Dropbox - async, ajax uploads with HTML5 in Sinatra
View dropbox.css
#dropbox {
position: relative;
}
#dropbox > input {
position: absolute;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
@kevincennis
kevincennis / bounce.js
Created Jul 13, 2013
Bounce an AudioBuffer to WAV with RecorderWorker.js
View bounce.js
// assuming you have an AudioBuffer instance called `buffer`,
// and an AudioContext (or OfflineAudioContext) called `ctx`...
// create a new Worker...
var worker = new Worker('recorderWorker.js');
// get it started and send some config data...
worker.postMessage({
command: 'init',
@vangberg
vangberg / README
Created Feb 22, 2009
Deploying a Sinatra app to Heroku
View README
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
@tonycoco
tonycoco / image_filters.rb
Created Jun 11, 2012
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
View image_filters.rb
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@anildigital
anildigital / client.js
Created Apr 9, 2011
Twitter streaming API example twitter-node and socket.io
View client.js
<!DOCTYPE HTML>
<head>
<title>Codesnippit NodeJS Twitter Tracker Client</title>
</head>
<body>
<ul></ul>
<script>
(function() {
var script = document.createElement("script");
script.src = "http://code.jquery.com/jquery.min.js";
@biilmann
biilmann / readme.md
Created Oct 14, 2015
Quick Guide to Private NPM Modules on Netlify
View readme.md

Using NPM Private Modules on Netlify

Create a .npmrc file for your project like this:

//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Then find your token inside the ~/.npmrc file in your home folder and set it as an NPM_TOKEN environment variable through netlify's admin UI.