Skip to content

Instantly share code, notes, and snippets.

View nickcharlton's full-sized avatar

Nick Charlton nickcharlton

View GitHub Profile
@philoye
philoye / heartbeat.rb
Created August 11, 2014 00:49
Simple rack middleware to provide a health monitor for rails app using sidekiq, memcache, and activerecord.
module Rack
class Heartbeat
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] == "/pulse"
@messages = []
@simonwhitaker
simonwhitaker / UIColor+GSAdditions.h
Created September 15, 2011 11:19
A category on UIColor adding +(UIColor*)colorWithHexValue:(NSString*)hexValue;
//
//
// UIColor+GSAdditions.h
//
// Created by Simon Whitaker at Goo Software Ltd on 15/09/2011.
//
#import <UIKit/UIKit.h>
@interface UIColor (GSAdditions)
@henare
henare / CHANGELOG.md
Created March 3, 2012 03:06
debian-squeeze.box

debian-squeeze-64

A Debian Squeeze 64-bit Vagrant base box that is designed to be as vanilla as possible so that you can add your own configuration in Chef recipes or Puppet manifests.

http://dl.dropbox.com/u/174733/debian-squeeze-64.box

Changelog follows:

2012-03-03

@fnichol
fnichol / ruby-install-prof.sh
Created February 15, 2015 23:00
Build an MRI Ruby version for ruby-prof using ruby-install
# Build an MRI Ruby version ready for ruby-prof (https://github.com/ruby-prof/ruby-prof)
VERSION=2.2.0
ruby-install \
--install-dir ~/.rubies/ruby-prof-$VERSION \
-p https://raw.githubusercontent.com/skaes/rvm-patchsets/master/patches/ruby/$VERSION/railsexpress/01-zero-broken-tests.patch \
-p https://raw.githubusercontent.com/skaes/rvm-patchsets/master/patches/ruby/$VERSION/railsexpress/02-improve-gc-stats.patch \
-p https://raw.githubusercontent.com/skaes/rvm-patchsets/master/patches/ruby/$VERSION/railsexpress/03-display-more-detailed-stack-trace.patch \
-p https://raw.githubusercontent.com/skaes/rvm-patchsets/master/patches/ruby/$VERSION/railsexpress/04-backport-401c8bb.patch \
@attilagyorffy
attilagyorffy / Vagrantfile
Last active March 19, 2016 12:46
Server provisioning in Vagrant using Rails' secrets
require 'yaml'
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
# Parse secrets from Rails' config file (ignored in the repo)
secrets_file = File.expand_path(File.join(File.dirname(__FILE__), 'config', 'secrets.yml'))
secrets = YAML::load_file secrets_file
@JoeyButler
JoeyButler / chat.html
Created October 24, 2011 00:14
Simple Chat app
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script>
<script>
$(document).ready(function(){
function debug(str){ $("#debug").append("<p>"+str+"</p>"); };
if(typeof WebSocket === 'undefined') {
alert("Your browser does not support websockets.")
}
@tvandervossen
tvandervossen / stimulus_notes.md
Last active May 5, 2018 09:21
Quick guide for people who want to add stimulus.js to a Rails 5.2 app but who haven’t used much Modern JavaScript

How to add stimulus.js to a Rails 5.2 app

This might also work or Rails 5.1, but I haven’t tried that yet.

Add the webpacker gem to your Gemfile:

# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker'

Then run (assuming you’re on macOS and using Homebrew):

@tjmw
tjmw / active_model.rb
Created April 27, 2017 08:37
Quack like an ActiveRecord object
class FakeRecord
# ActiveModel plumbing to make `form_for` work
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
attr_accessor :foo, :bar
validates :foo, presence: true
@masonforest
masonforest / Dockerfile
Last active March 18, 2020 16:34
Test Drive Your Dockerfiles with RSpec and ServerSpec
FROM ubuntu:14.04
MAINTAINER Mason Fischer <mason@thoughtbot.com>
RUN apt-get update && apt-get install -y nodejs
@holman
holman / emoji_test.rb
Last active June 18, 2020 01:27
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,