Skip to content

Instantly share code, notes, and snippets.

View runlevel5's full-sized avatar

Trung Lê runlevel5

View GitHub Profile
@cjheath
cjheath / cql.rake
Created December 6, 2018 04:19
lib/tasks/cql.rake for a Rails Application
namespace 'cql' do
APPLICATION = 'my-app-name'
desc 'Check that there are no errors in CQL'
task :check do
system <<-END
set -x
cd "db/app"
schema_compositor --binary #{APPLICATION}.cql
END
@jodosha
jodosha / entity_initialize_indifferent_access.rb
Last active August 29, 2015 14:12
Lotus::Entity#initialize bench: metaprogramming vs iterative
#!/usr/bin/env ruby
require 'rubygems'
require 'benchmark/ips'
require 'lotus/utils/attributes'
class MetaProgrammingEntity
def initialize(attributes = {})
attributes = Lotus::Utils::Attributes.new(attributes)
@a = attributes.get(:a)
@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@mdub
mdub / aws-repl.rb
Last active December 23, 2018 14:12
A simple Ruby-based AWS console
#! /usr/bin/env ruby
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
require 'aws-sdk'
@akitaonrails
akitaonrails / mountain-lion-brew-setup.markdown
Created June 18, 2012 13:43 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion Preview 4 and Homebrew to Be Happy

Get Mountain Lion Preview 4 and Homebrew to Be Happy

1) Install XCode 4.5 Developer Preview into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@jc00ke
jc00ke / capybara-helpers.rb
Created January 28, 2012 07:47
Capybara helpers
def screenshot
require 'capybara/util/save_and_open_page'
now = Time.now
p = "/#{now.strftime('%Y-%m-%d-%H-%M-%S')}-#{rand}"
Capybara.save_page body, "#{p}.html"
path = Rails.root.join("#{Capybara.save_and_open_page_path}" "#{p}.png").to_s
page.driver.render path
Launchy.open path
end
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@saetia
saetia / gist:1623487
Last active July 16, 2024 05:56
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat