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
Object.prototype.extends = function(thing) { | |
var self = this; | |
for( var prop in thing ) { | |
if (thing.hasOwnProperty(prop)) { | |
self[prop] = thing[prop]; | |
} | |
} | |
}; | |
var Foo = { |
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
namespace :db do | |
namespace :drop do | |
desc "Drop every table in the database. (Does not require DROP DATABASE permission.)" | |
task :tables => :load_config do | |
config = ActiveRecord::Base.configurations[Rails.env || 'development'] | |
begin | |
ActiveRecord::Base.establish_connection(config) | |
puts "Dropping #{ActiveRecord::Base.connection.tables.count} tables." | |
ActiveRecord::Base.connection.tables.each do |table| |
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
RSpec.configure do |config| | |
# ... | |
# Open output of failing specs. | |
config.after(:each) do | |
if example.exception and example.metadata[:type] == :request | |
save_and_open_page | |
end | |
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
[65] pry(main)> ftp_abc = 'ftp://www.abc.net.au/hifive/' | |
=> "ftp://www.abc.net.au/hifive/" | |
[66] pry(main)> http_abc = 'http://www.abc.net.au/hifive/' | |
=> "http://www.abc.net.au/hifive/" | |
[67] pry(main)> f = URI::parse ftp_abc | |
=> #<URI::FTP:0x7ffe21b416b8 URL:ftp://www.abc.net.au/hifive/> | |
[68] pry(main)> h = URI::parse http_abc | |
=> #<URI::HTTP:0x7ffe21b37c58 URL:http://www.abc.net.au/hifive/> | |
[69] pry(main)> f.path | |
=> "hifive/" |
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
function prompt_char { | |
if [[ -d './.svn/' ]]; then echo '§' && return; fi | |
# it's faster to test for a `./.svn` directory than | |
# to exec `svn` & check return codes | |
git branch >/dev/null 2>&1 && echo '±' && return | |
hg root >/dev/null 2>&1 && echo '☿' && return | |
# redirect output of commands to /dev/null & | |
# echo custom char based on successful execution | |
echo '○' |
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
ActiveAdmin::Register Package do | |
# A custom action we want treated like the :show or :edit actions. | |
member_action :overview, :method => :get do | |
@package = Package.find params[:id] | |
end | |
# Add the actions for the :overview action. | |
template_actions_for :overview, :show | |
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
#!/usr/bin/ruby | |
colours = { :white => "\033[1;37m" \ | |
, :yellow => "\033[1;33m" \ | |
, :green => "\033[1;32m" \ | |
, :blue => "\033[1;34m" \ | |
, :cyan => "\033[1;36m" \ | |
, :red => "\033[1;31m" \ | |
, :magenta => "\033[1;35m" \ | |
, :black => "\033[1;30m" \ |
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
DO | |
$$ | |
DECLARE | |
hidden_table record; | |
BEGIN | |
FOR hidden_table IN | |
SELECT schemaname, tablename FROM pg_tables | |
WHERE schemaname = (SELECT MAX(schemaname) FROM pg_tables WHERE schemaname LIKE 'snapshot_%') | |
LOOP | |
EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(hidden_table.tablename) || ';'; |
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
spoiler, .spoiler { | |
-webkit-transition: all 125ms linear; | |
-moz-transition: all 125ms linear; | |
-o-transition: all 125ms linear; | |
transition: all 125ms linear; | |
filter: blur(10px); | |
-webkit-filter:blur(10px); | |
-moz-filter: blur(10px); | |
-o-filter: blur(10px); |
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
~/work/tmp/version_file <master +>± git status | |
# On branch master | |
# Changes to be committed: | |
# (use "git reset HEAD <file>..." to unstage) | |
# | |
# new file: foo | |
# | |
~/work/tmp/version_file <master +>± git diff --staged | |
diff --git a/foo b/foo | |
new file mode 100644 |
OlderNewer