This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -z $1 ]; then | |
docker_machine_count=`docker-machine ls -q | wc -l | sed 's/ //g'` | |
if [ $docker_machine_count == "1" ]; then | |
machine=`docker-machine ls -q` | |
elif [ $docker_machine_count == "0" ]; then | |
echo 'No docker machines were found with the following command:' | |
echo ' docker-machine ls -q' | |
exit | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Flash : DynamicObject | |
{ | |
private readonly TempDataDictionary _store; | |
private const string KeyPrefix = "Flash"; | |
public Flash(TempDataDictionary store) | |
{ | |
_store = store; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of a DelayedJob that syncs info with mailchimp | |
class SyncMailchimp < Struct.new(:opts) | |
include Dobexer::ExceptionNotifier | |
def run_hominid(attempts = 0, &block) | |
attempts += 1 | |
block.call | |
rescue EOFError => e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
user nobody nogroup; | |
pid /tmp/nginx.pid; | |
error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; | |
accept_mutex off; | |
} | |
http { | |
default_type application/octet-stream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queue: ./queue.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Dynamic Elements v1.0 | |
Show/hide, require/not require, and enable/disable fields based on checkboxes and select fields. | |
Class names: "lock" will disable an element, "hide" will hide an element, "need" will require an element. | |
Adding the ID of a checkbox as a class to an element will make it show/enabled/required: | |
i.e. <input type="checkbox" name="getName" id="getName" /> <input type="text" name="yourName" class="getName lock hide require" /> | |
Adding the ID and value of a select field as a class to an element will make it show/enabled/required (format is 'ID-Value'): | |
i.e. <select name="getTitle" id="getTitle"><option>Mr</option><option>Mrs</option><option>Other</option> <input type="text" name="yourTitle" class="getTitle-Other lock hide require" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Hstore Method Missing Extension | |
module HstoreModel | |
def method_missing(method, *args, &block) | |
key = method.to_s.gsub('=','').to_sym | |
sym_options = options.symbolize_keys | |
if !self.class.attribute_methods_generated? | |
self.class.define_attribute_methods | |
if respond_to_without_attributes?(method) | |
send(method, *args, &block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################### | |
# http://stackoverflow.com/questions/639647/git-and-asp-mvc | |
################### | |
# | |
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :orphaned_check => :environment do | |
Dir[Rails.root.join('app/models/*.rb').to_s].each do |filename| | |
klass = File.basename(filename, '.rb').camelize.constantize | |
next unless klass.ancestors.include?(ActiveRecord::Base) | |
orphanes = Hash.new | |
klass.reflect_on_all_associations(:belongs_to).each do |belongs_to| | |
assoc_name, field_name = belongs_to.name.to_s, belongs_to.foreign_key.to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUT="changesets.json" | |
echo "[" > $OUT | |
hg log | grep "^changeset:" | sed 's/changeset.*:/ "/g' | sed 's/$/",/g' | sed '$s/,$//' >> $OUT | |
echo ']' >> $OUT |
OlderNewer