Skip to content

Instantly share code, notes, and snippets.

@kipcole9
kipcole9 / function_clause.ex
Created October 23, 2019 11:04
Debug Elixir Function Clause errors
defmodule FunctionClause do
@moduledoc """
Format function clauses using Exception.blame/3
"""
@doc """
Given a `module`, `function`, and `args` see
if that function clause would match or not match.
This is useful for helping diagnose function
@nylki
nylki / char-rnn recipes.md
Last active March 16, 2024 15:13
char-rnn cooking recipes

do androids dream of cooking?

The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.

The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.

@ericlevine
ericlevine / migrate_repo.rb
Last active August 29, 2015 13:56
GitHub to GitHub repository migration script
require "json"
require "typhoeus"
require "pp"
# MigrateRepo usage instructions:
#
# The way this is used at Airbnb for migrating from GitHub to GHE is by
# creating a separate organization with no members called "migration",
# adding that as the target organization, and then once the migration
# has finished, moving it over to the intended location.
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@ymendel
ymendel / fishtank.html
Last active December 15, 2015 17:49
marquee fishtank — as seen at http://citizenx.cx/fishtank/
<html>
<head>
<title>Marquee Fishtank</title>
<style>
#fishtank {
width: 350px;
background-color: aqua;
}
#fish1 { color: red }
#fish2 { color: orange }
@rick
rick / bringit.rb
Created August 15, 2012 18:33
github summit fall 2012 hubot ignite talk
#!/usr/bin/env ruby
require 'github-campfire'
def ask_for_image(phrase)
`growlnotify -m "#{phrase}"`
GitHub::Campfire.notify("/img me #{phrase}", GitHub::Campfire::HUBOT)
end
phrases = [
'hubot ignite', # new presentation style
@paul
paul / _README.mkd
Created July 15, 2012 22:19
A better pretty_json.rb

Installation

  1. Copy prissy to ~/bin (or elsewhere in your $PATH)
  2. chmod +x prissy
  3. gem install awesome_print multi_json

Usage

$ some_command_that_outputs_json | prissy
#!/usr/bin/env ruby -pi.bak
# bacon before takes no argument
$_.sub!(/before\s*\(?\s*:each\s*\)?\s*/, 'before ')
# same with after
# No magic annoying spaces after 'should'.
# Matchers are methods on the Should object
$_.sub!(/\.should\s*/, '.should.')
# fix `should_not` -> `should._not`
@wilson
wilson / .vimperatorrc
Created November 15, 2010 04:33
Download the current youtube page in the background
" This gets added to your vimperatorrc; makes ':yt' trigger youtube-dl
" You can also bind it directly to a keystroke.
" Requires youtube-dl: https://github.com/rg3/youtube-dl
" On a Mac with Homebrew installed, you can 'brew install youtube-dl'
comm! yt 'exe "!" + eval("plugins.youtubeDownload.youtubeDownload()")'
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end