Skip to content

Instantly share code, notes, and snippets.

View erkattak's full-sized avatar

Erik Straub erkattak

View GitHub Profile
@erkattak
erkattak / turbo_dev.rb
Created August 27, 2014 15:53
TurboDev - Speed up Rails development environment's asset serving
# from https://github.com/discourse/discourse/blob/21e08a423e8839c6bacb4ee688b924a4fb71113f/lib/middleware/turbo_dev.rb
# lib/middleware/turbo_dev.rb
module Middleware
# Cheat and bypass Rails in development mode if the client attempts to download a static asset
# that's already been downloaded.
#
@kixxauth
kixxauth / better-javascript.js
Created March 31, 2012 17:41
JavaScript Objects and Promises
//
// Typical Prototype composure in JS; This is the classical way of creating and
// using objects in JS.
//
// "Super" or "Parent" object prototype
function Cat(color) {
this.color = color;
this.saying = 'meowwww';
}
@NapoleonWils0n
NapoleonWils0n / Mountain Lion Web Sharing.txt
Created November 11, 2012 00:13
macosx: Mountain Lion apache set up
Mountain Lion Web Sharing
Apache/WebSharing
The first difference in the new OS X 10.8 is the dropping of the GUI option to turn on Web Sharing in the System Preferences, it may be gone but Apache is definitely installed in the lower level of the OS and ready to go.
No Web Sharing Option in System Preferences
Apache is pre-installed and needs to be enabled via the command line - /Applications/Utilities/Terminal
@webgio
webgio / JasmineSpec.coffee
Last active December 11, 2015 21:48
Sample Jasmine test for Marionette.js module
describe 'App.HeaderModule', ->
beforeEach ->
@headerModule = window.App.HeaderModule
it 'should exist', ->
expect(@headerModule).not.toBeUndefined()
describe 'starting', ->
@thbar
thbar / up-and-running-with-edeliver-on-do.md
Created January 29, 2016 22:40 — forked from mattweldon/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
@jletourneau
jletourneau / ruck-beer.py
Last active January 27, 2018 05:04
Ruck beer list scraper
#!/usr/bin/python
from pyquery import PyQuery as pq
import re
import datetime
print datetime.datetime.now().strftime('%c')
print
doc = pq(url='http://www.beermenus.com/places/4733-the-ruck')
@ches
ches / follow_observer_spec.rb
Last active November 29, 2018 01:34
Example of testing Rails observers in isolation for cross-cutting concerns
require 'spec_helper'
# Bustle is a pubsub system used for activity streams:
# https://github.com/fredwu/bustle
#
# Here when a person follows another (or a discussion, for instance), the observer wires
# up pubsub between them for future activity notifications. The Follow model knows nothing
# about the implementation choices for the pubsub system.
describe FollowObserver do
subject { FollowObserver.instance }
@subelsky
subelsky / puma_rails_heroku.rb
Created October 31, 2012 13:51
Setting up Puma and Rails on Heroku
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
@mattweldon
mattweldon / up-and-running-with-edeliver-on-do.md
Last active September 3, 2021 16:48
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private