Skip to content

Instantly share code, notes, and snippets.

View nickcharlton's full-sized avatar

Nick Charlton nickcharlton

View GitHub Profile
@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
@orta
orta / Issue.md
Last active April 29, 2023 08:19
Disclosable Sections in a GH issue
Summary text. Hello World, how is it going?
@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
@johnbuhay
johnbuhay / setup-users.groovy
Created January 21, 2016 01:15
jenkins init.groovy.d script for configuring users
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import org.jenkinsci.plugins.plaincredentials.*
import org.jenkinsci.plugins.plaincredentials.impl.*
import hudson.util.Secret
import hudson.plugins.sshslaves.*
@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 \
@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
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@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,
@gbuesing
gbuesing / ml-ruby.md
Last active February 28, 2024 15:13
Resources for Machine Learning in Ruby

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby

Gems