- First, you'll need the
pry-stack_explorer
gem. - Then put
<% binding.pry %>
into yourdatabase.yml
file. - Start a
rails c
- Pry will open when it starts loading the
database.yml
file - Navigate
up
the stack until you reach the initializer loading - Run
initializers.tsort.collect &:name
to see the order that the initialiser are being loaded. - You should (hopefully) see figaro_load before activerecord.initialize_database
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
exiftool -r "-lensId>lens" <folder name> -overwrite_original |
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
context "Parsing example file" do | |
setup { | |
@xml = File.open(File.expand_path(File.dirname(__FILE__) + '/../EICK.xml'), 'r'){|f| f.read } | |
parse_hamweather_data(@xml) | |
} | |
should_change("the number of forecasts", :by => 8) {Forecast.count} | |
should_change("the number of current forecasts", :by => 1) {Forecast.count :conditions => 'current = true'} | |
should_change("the number of 3hour forecasts", :by => 7) {Forecast.count :conditions => 'priority = 2'} | |
end |
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
# A module for creating around callbacks in a model | |
module Piddle | |
module TimelineFor | |
def self.included(klass) | |
klass.send(:extend, ClassMethods) | |
end | |
module ClassMethods | |
def timeline_for(event, opts={}) | |
method_name = :"timeline_for_#{event.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
#!/usr/bin/env ruby | |
spec_hits = [] | |
checks = { | |
'_spec\.rb$' => ['focus:[:space:]*true'], | |
'\.rb$' => ['binding\.pry', 'debugger'] | |
} | |
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
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
-- Check for vulnerability to the unsafe query risk in Rails mentioned here: https://groups.google.com/forum/#!topic/rubyonrails-security/8CVoclw-Xkk | |
-- Are any columns named the same as their table? (high risk) | |
select * from information_schema.columns where table_name = column_name; | |
-- Are any columns named the same as any other table (might pose a risk during join) | |
select * from information_schema.columns where column_name in (select distinct table_name from information_schema.columns); |
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
############################################################ | |
# Daemon | |
############################################################ | |
# Start in daemon (background) mode and release terminal (default: off) | |
daemon off | |
# File to store the process ID, also called pid file. (default: not defined) | |
process_id_file /var/run/motion/motion.pid |
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
// ==UserScript== | |
// @name Daft House Prices | |
// @namespace http://ideasasylum.com | |
// @version 0.2 | |
// @description Replace Daft house prices with CB deposit and income limits | |
// @author Jamie Lawrence @ideasasylum | |
// @match https://www.daft.ie/* | |
// @grant none | |
// ==/UserScript== |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
require 'rest-client' | |
file = 'names.txt' | |
key = 'YOUR GENDER API KEY' | |
raw = [] | |
results = Hash.new 0 | |
errors = 0 | |
num_names = 0 |
OlderNewer