Skip to content

Instantly share code, notes, and snippets.

@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@kaeff
kaeff / .bowerrc
Last active December 15, 2015 22:50
How to use Bower with the Asset Pipeline in Rails
{
"directory" : "vendor/assets/components"
}
@d3noob
d3noob / .block
Last active July 11, 2023 19:59
Simple vertical d3.js tree diagram
license: mit
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@bcardiff
bcardiff / ast_dump.cr
Created June 30, 2015 21:58
Crystal AST dump
require "compiler/crystal/**"
class Object
def dump_inspect(io, level)
io << " " * level
to_s(io)
io << " :: " << self.class
end
end
@ikennaokpala
ikennaokpala / install_puma_gem.sh
Last active April 14, 2018 10:51
install puma gem on el capitan
brew install openssl
brew link --force openssl
gem install puma
ALternatively:
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
gem install puma
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@idleberg
idleberg / sublime-text-macos-context-menu.md
Last active February 20, 2024 09:37 — forked from vincentmac/sublime-text-osx-context-menu.md
“Open in Sublime Text” in macOS context-menu

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
@hnakamur
hnakamur / .rpmmacros
Last active December 25, 2020 01:28
rpm sign
# The original settings confirmed by running: rpm --showrc
# -14: __gpg %{_bindir}/gpg2
# -14: __gpg_check_password_cmd %{__gpg}
# gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
#
# -14: __gpg_sign_cmd %{__gpg}
# gpg --batch --no-verbose --no-armor --passphrase-fd 3
# %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}}
# --no-secmem-warning
# -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
@waj
waj / docker-compose.yml
Last active March 14, 2019 20:49
Launch Rancher server with Docker Compose
version: '2'
volumes:
cattle:
mysql-log:
nginx-certs:
nginx-dhparam:
nginx-vhost:
nginx-html:
services: