Skip to content

Instantly share code, notes, and snippets.

View jrgifford's full-sized avatar
:shipit:
This is like AIM all over again, isn't it?

James Gifford jrgifford

:shipit:
This is like AIM all over again, isn't it?
View GitHub Profile
@Arkham
Arkham / memeorama.md
Last active December 30, 2015 00:49
Meme-O-Rama

Meme-O-Rama!

The Basics

Setup a new Rails app and start it

  • rails new memeorama
  • rails server

Create our first scaffold

  • rails generate scaffold meme name:string description:text picture:string
@slemiere
slemiere / gist:a59fdbfadbd3726eb622
Last active May 18, 2016 01:39
Blink + PagerDuty
#!/usr/bin/env ruby
require 'httparty'
require 'blink1'
class PagerDuty
include HTTParty
TOKEN = "YOUR_PAGERDUTY_API_TOKEN"
PAGERDUTY_DOMAIN = "YOUR_PAGERDUTY_DOMAIN"
base_uri "https://#{PAGERDUTY_DOMAIN}.pagerduty.com/api/v1"
@nateberkopec
nateberkopec / benchmark.rb
Last active November 17, 2016 02:24
Why is Regex.match faster with this string in Ruby 2.4?
require 'benchmark/ips'
require 'securerandom'
BIG_STRING = <<-EOS
{:event_id=>"c18ae35e83234021bb78d8ba8a8ef2da", :timestamp=>"2016-11-16T23:27:52", :time_spent=>nil, :level=>40, :platform=>"ruby", :sdk=>{"name"=>"sentry-raven", "version"=>"2.1.3"}, :contexts=>{:server_os=>{"name"=>"Darwin", "version"=>"Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64", "build"=>"16.1.0", "kernel_version"=>"Darwin nodachi.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64"}, :runtime=>{"name"=>"ruby", "version"=>"ruby 2.3.2p217 (2016-11-15 revision 56796) [x86_64-darwin16]"}}, :logger=>"", :culprit=>"benchmarks/benchmark.rb in / at line 10", :server_name=>"nodachi.local", :release=>"425c535", :environment=>"default", :modules=>{"rake"=>"11.3.0", "concurrent-ruby"=>"1.0.2", "i18n"=>"0.7.0", "minitest"=>"5.9.1", "thread_safe"=>"0.3.5", "tzinfo"=>"1.2.2", "activesupport"=>"5.0.0.1", "builder"=>"3.2.2", "erubis"=>"2
@somazx
somazx / Gemfile
Last active February 1, 2017 20:03
Using Amazon Elasticsearch securely (signed requests) with Rails & searchkick gem on Heroku.
gem 'elasticsearch', '>= 1.0.15'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'patron'
gem 'faraday_middleware-aws-signers-v4'
gem 'searchkick'
@HusseinMorsy
HusseinMorsy / pomodoro.rb
Created March 18, 2012 00:33
script for pomodoro timer with tmux and Pomodoro-App
#!/usr/bin/env ruby
#
# for use with ugol's pomodoro app (https://github.com/ugol/pomodoro) and tmux
# use applescript to set the time
# How to use it:
# 1. Open preferences from the pomodoro app
# 2. Choose script
# 3. Set start, reset and end to: do shell script "/usr/local/bin/pomodoro reset"
# 4. set every 1 min to: do shell script "/usr/local/bin/pomodoro decrease"
@jnv
jnv / Gemfile
Created September 17, 2013 23:04
trello2github: A hacky and awful Trello cards to GitHub Issues import. Imports Trello color labels and cards' lists as labels, skips archived cards.
source "https://rubygems.org"
gem "octokit", "~> 2.0"
gem "json"
gem "recursive-open-struct"
anonymous
anonymous / abyss-as-a-service
Created November 20, 2015 14:56
Floating serenely through a peaceful abyss, a sigh escapes; content.
A siren wails, you're jolted from your respite
/dev/xsdb1 is at 100%
A cacophony of alerts screech from the phone.
Upset is the fragile balance, failure cascades.
Was only a matter of time.
Get some coffee.
All you ping seems to crumble, machine after machine fall; a massacre of uptime.

Preview build: Container grouping and stack composition

NOTE: this is out of date - refer to moby/moby#9694

Here is a preview build of two new features we’re working on concurrently: container grouping (docker groups) and stack composition (docker up). Together, they will eventually form a complete replacement for Fig.

@KelSolaar
KelSolaar / Pinboard.scpt
Created March 9, 2019 19:20 — forked from itst/Pinboard.scpt
Import and update your Pinboard bookmarks to DEVONthink
(* Import and update your Pinboard bookmarks to DEVONthink
Based on work done by Christian Grunenberg on Mon Jan 23 2006,
Rafael Bugajewski to support Pinboard instead of Delicious on Sun Dec 19 2010 and
Andreas Zeitler on Sun Mar 03 2011 to display user feedback when finished.
By Sascha A. Carlin <https://sascha.carlin.de/> on 2018-03-07 to set the creation date of new record, show progress bar, use Pinboard Auth Token, use modification date of folder to fetch only recent items
Copyright (c) 2018. All rights reserved. *)
use framework "Foundation"
@rvandervort
rvandervort / pascal.rb
Created January 6, 2012 08:56
Pascal's Triangle in Ruby
def pascal_calc(row_num)
if row_num == 0
return [1]
end
previous = pascal_calc(row_num - 1)
ret = []
(previous.length - 1).times do |i|