A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
10 context 'when update products with valid data' do | |
9 it do | |
8 meta = described_class.enqueue(company.id, bind_data) | |
7 binding.pry #NOTE: debugger | |
6 | |
5 Resque.inline = true | |
4 worker = Resque::Worker.new(:company_products) | |
3 binding.pry #NOTE: debugger | |
2 worker.work(0) | |
1 |
# Credit Brandon Weiss of http://anti-pattern.com/dirty-associations-with-activerecord | |
# app/models/dirty_associations.rb | |
module DirtyAssociations | |
attr_accessor :dirty | |
attr_accessor :_record_changes | |
def make_dirty(record) | |
self.dirty = true | |
self._record_changes = record |
class Module | |
class ConstraintError < TypeError; end | |
def where(meth, constraint) | |
m = Module.new do | |
define_method(meth) do |*args| | |
args.zip(constraint.keys.first) do |arg, t| | |
raise ConstraintError, "type #{t} is expected, but #{arg.inspect} is passed" unless arg.is_a?(t) | |
end | |
ret = super(*args) |
<%= | |
f.association :category_id, collection: Category.roots, | |
as: :grouped_select, | |
group_method: :children, group_label_method: :name, | |
label_method: :name | |
%> |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf
File locations:
nginx.conf
to /usr/local/etc/nginx/
default.conf
and default-ssl.conf
to /usr/local/etc/nginx/sites-available
homebrew.mxcl.nginx.plist
to /Library/LaunchDaemons/
#!/usr/bin/php | |
############################################################################# | |
# | |
# S P H I N X C O N F I G U R A T I O N | |
# | |
############################################################################# | |
<?php | |
define('SPHINX_CONF_SOURCES_DIR', __DIR__ . DIRECTORY_SEPARATOR . "sources.d"); |