Skip to content

Instantly share code, notes, and snippets.

View JohnSmall's full-sized avatar

John Small JohnSmall

View GitHub Profile
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@mhayes
mhayes / gist:984326
Created May 21, 2011 07:14 — forked from kirs/gist:984320
broken rakefile
require File.expand_path('../config/application', __FILE__)
require 'rake'
module ::Dpp
class Application
include Rake::DSL
end
end
module ::RakeFileUtils
@elliot
elliot / Luhn.coffee
Created August 23, 2011 07:24
Luhn Algorithm in CoffeeScript
validateLuhn = (number) ->
odd = true
sum = _(number.split '').reduceRight (total, digit) ->
digit = parseInt(digit)
digit *= 2 if (odd = !odd)
digit -= 9 if digit > 9
total + digit
, 0
@shtirlic
shtirlic / gist:5052306
Last active November 18, 2021 17:58 — forked from joelmoss/gist:2470666
set :stage, 'production'
set :shared_children, shared_children << 'tmp/sockets'
puma_sock = "unix://#{shared_path}/sockets/puma.sock"
puma_control = "unix://#{shared_path}/sockets/pumactl.sock"
puma_state = "#{shared_path}/sockets/puma.state"
puma_log = "#{shared_path}/log/puma-#{stage}.log"
namespace :deploy do
desc "Start the application"
@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
module FactoryGirl::Syntax::Methods
def find_or_create(name, attributes = {}, &block)
factory = FactoryGirl.factory_by_name(name)
klass = factory.build_class
factory_attributes = FactoryGirl.attributes_for(name)
attributes = factory_attributes.merge(attributes)
result = klass.find_by(attributes, &block)
@barbolo
barbolo / pdf_to_xml.rb
Last active January 16, 2023 04:05
Convert PDF to XML in Ruby using poppler-utils
# Install dependencies:
#
# posix-spawn (check all benefits at https://github.com/rtomayko/posix-spawn)
# gem install posix-spawn
#
# Poppler utils (http://poppler.freedesktop.org/)
# apt-get install poppler-utils
#
require 'posix/spawn'
@lancehunt
lancehunt / oauth2-authcode.sh
Last active May 20, 2023 12:25
TradeStation OAuth2 Auth Code tester
#!/bin/bash
######################################################
# Stolen & Modified by Lance Hunt
# Author: Unknown
#
# Please let me know who the righful author is so I
# can give due credit
######################################################
echo '* Installing oauth2 Ruby gem'
@markblundeberg
markblundeberg / bip62_and_schnorr.md
Last active December 13, 2019 22:39
BIP62 and Schnorr: a new era in BCH privacy and smart contracting

Two new features are coming to Bitcoin Cash soon, hopefully in the May 2019 upgrade. I'd like to take the time to explain why I'm so excited about them. In short, we will be able to do:

  • Payment channels hidden as ordinary payments.
  • Atomic swaps hidden as ordinary payments.
  • Lightning-style payment channel networks too, if we want.
  • Secure chains of unconfirmed transactions involving multiple parties (layer 2).

That all may sound incredible, and I'm going to explain in this document how it is so.

--- Mark B. Lundeberg, 2019 Jan 29 bitcoincash:qqy9myvyt7qffgye5a2mn2vn8ry95qm6asy40ptgx2