Skip to content

Instantly share code, notes, and snippets.

@remear
remear / Gemfile
Created February 8, 2013 14:18
Gemfile fresh from Rails 3.2.11
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@remear
remear / rubygems-aws-contributors.txt
Created January 31, 2013 21:04
rubygems-aws Contributors
vertis
phlipper
reinh
dwradcliffe
jtimberman
coderanger
btm
skottler
mitchellh
englishm
@remear
remear / gist:4003564
Created November 2, 2012 18:52 — forked from dumindu/gist:3359218
How to target mobile devices with CSS Media Queries
@media only screen and (-webkit-device-pixel-ratio: .75) {
/* CSS for Low-density Android screens goes here *
* Ex: HTC Evo, HTC Incredible, Nexus One */
}
@media only screen and (-webkit-device-pixel-ratio: 1) and (max-device-width: 768px) {
/* CSS for Medium-density Android screens goes here *
* Ex: Samsung Ace, Kindle Fire, Macbook Pro *
* max-device-width added so you don't target laptops and desktops */
}
{
'email_address': 'business-merchant@example.org',
'name': 'Dwight\'s Flowers',
'merchant': {
'type': 'business',
'name': 'Dwight\'s Flowers LLC',
'tax_id': '123-123-123',
'phone_number': '(800) 555-1234',
'street_address': '1 My Businesses Registered Address',
'postal_code': '94301',
module Admin::InvoicesHelper
def status_tag(status, level)
content_tag(:span, status.titleize, :class => "status #{status} #{level}")
end
end
@remear
remear / gist:3136375
Created July 18, 2012 14:00
Topic Ideas
config.thread_safe
Understanding fibers vs threads - Which one when and where?
Observers. Evil or Useful?
Securing Rails Applications - Common security mistakes and how to avoid them
Demystify Memcached
Fixtures and Test::Unit
Performance Testing Rails Applications For Real
Pry
Relations in MongoDB - items document. lists holds references to all items for a list. Like to see this both with mongoid and CLI
Elixr - What is it? What would I use it for?
@remear
remear / brew_config.txt
Created June 26, 2012 18:52
Brew Config - Mac Pro - 10.8 Preview 4 Update 3
$ brew --config
HOMEBREW_VERSION: 0.9
HEAD: 83c77237ee4f99cae6313152b93eb686b2852645
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit penryn
OS X: 10.8-x86_64
Xcode: 4.5 => /Applications/Xcode45-DP2.app/Contents/Developer
CLT: 4.5.0.0.1.1249367152
GCC-4.0: N/A
@remear
remear / os_x_free_memory.txt
Created April 12, 2012 19:30
Free Memory Command on OS X
echo -e "\n$(top -l 1 | awk '/PhysMem/';)\n"
=> PhysMem: 1701M wired, 6232M active, 976M inactive, 8909M used, 3376M free.
Add to ~/.bash_profile
alias freemem="top -l 1 | awk '/PhysMem/'"
A more brief output:
require "test/unit"
class TestMaximum < Test::Unit::TestCase
def maximum(arr)
arr.length == 1 ? arr.first : arr.sort.last
end
def test_maximum
assert_equal maximum([2, 42, 22, 02]), 42
assert_equal maximum([-2, 0, 33, 304, 2, -2]), 304
$ time ruby -e "100000000.times { [-2, 0, 33, 304, 2, -2].max }"
real 1m43.896s
user 1m43.859s
sys 0m0.031s
$ time ruby -e "100000000.times { [-2, 0, 33, 304, 2, -2].sort.last }"
real 1m33.644s
user 1m33.612s