Skip to content

Instantly share code, notes, and snippets.

View resistorsoftware's full-sized avatar

David Lazar resistorsoftware

View GitHub Profile
A::B is a system with 4 tokens: `A#`, `#A`, `B#` and `#B`.
An A::B program is a sequence of tokens. Example:
B# A# #B #A B#
To *compute* a program, we must rewrite neighbor tokens, using the rules:
A# #A ... becomes ... nothing
A# #B ... becomes ... #B A#
@zulhfreelancer
zulhfreelancer / export_import_heroku_database.md
Last active May 6, 2021 14:28
How to export Heroku Postgres Database to Localhost Database (Rails)?

How to export Heroku Postgres Database to Localhost Database (Rails)?

Step 1

$ cd /path/to/your/rails/app
$ heroku pg:backups capture
$ curl -o latest.dump `heroku pg:backups public-url`

OR
@kripy
kripy / unicorn.rb
Created January 14, 2015 01:33
Heroku Sequel Fork
# Using Sequel with Sinatra (Unicorn) on Heroku and getting this error:
# Sequel::DatabaseDisconnectError - PG::ConnectionBad: PQconsumeInput() SSL error: decryption failed or bad record mac.
# Need to do some forking.
# In unicorn.rb:
worker_processes 4 # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 30 seconds
preload_app true # avoid regeneration of jekyll site for each fork
before_fork do |server, worker|
Signal.trap 'TERM' do
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
  • 1 1/3 lb grass-fed beef
  • 2 tbsp Worcestershire sauce
  • 3/4 tsp ground coriander seed
  • 1/2 tsp garlic powder
  • 1/4 tsp ground cumin
  • 4 tbsp softened butter
  • 1/2 tsp freshly ground pepper
  • 1/2 tsp freshly ground sea salt
  • 4 pieces of fresh cheese (Muenster or sharp cheddar are best)
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@clarkware
clarkware / lyrics.rb
Created September 10, 2012 20:05
Random Lyrics
#!/usr/bin/env ruby
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API
require 'open-uri'
require 'json'
require 'tmpdir'
ARTIST = "Johnny Cash"

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@garyharan
garyharan / dot_pryrc
Created June 18, 2012 14:23
Awesome Print + Pry == Awesome Pry
require "rubygems"
require "awesome_print"
Pry.print = proc { |output, value| output.puts value.ai }
@resistorsoftware
resistorsoftware / Fixed up and modernized Expo gist
Created April 4, 2012 14:46
Meta Tagger Snippet for Expo Theme
<link rel="canonical" href="{{ canonical_url }}" />
{% assign maxmeta = 155 %}
{% if template contains 'product' %}
{% assign mf = product.metafields.meta_data %}
{% unless mf == empty %}
{% for mf in product.metafields.meta_data' %}
{% capture key %}{{ mf | first }}{% endcapture %}
{% if key == 'title' %}
<title>{{mf | last}}</title>
<meta name="title" content="{{mf | last}}" />