Skip to content

Instantly share code, notes, and snippets.

@elight
elight / jed.cnf
Last active August 29, 2015 14:08 — forked from jec006/jed.cnf
[mysqld]
# Slow Log
#slow_query_log = 1
#log_queries_not_using_indexes = 1
#long_query_time = 1
# Disable DNS lookups for performance
skip_name_resolve
# MySQL >= 5.5.5 uses InnoDB by default, but set it just in case
@elight
elight / hack.sh
Created March 31, 2012 12:03 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@elight
elight / config.ru
Created March 8, 2012 03:35
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@elight
elight / dataset_hack.rb
Created August 13, 2011 13:15 — forked from jeroenvandijk/dataset_hack.rb
Dataset hack
# Based on the discussion here: https://github.com/aiwilliams/dataset/issues/3
# Used to optimized the datasets being created in your tests.
# Currently works in a test suite for a production app with Postgresql
#
# TODO
# - gemify
# - add tests
# - be able to reuse datasets accross files (declare them in a shared context)
# - support other databases than postgres
# - file access optimization (only read once during a test run)
# Copy/paste of simple_format from Rails but with <p> removed.
def simpler_format(text, html_options={}, options={})
text = text ? String.new(text) : ''
text = sanitize(text) unless options[:sanitize] == false
text = text.gsub(/\r\n?/, "\n")
text.gsub!(/\n\n+/, "<br /><br />")
text.gsub!(/\n/, "<br />")
text.concat!("<br />")
text.html_safe
end