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
To insert the new rule before others (i.e. allow's) in the list: | |
ufw insert 1 deny from a.b.c.d | |
To check the placement: | |
ufw status numbered |
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
class Ipn < ActiveRecord::Base | |
belongs_to :user | |
serialize :message_data, Hash | |
# | |
# Return true if this is a payment. | |
# | |
def payment? | |
return paypal_subscription_payment? || weblaws_payment? | |
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
[7] pry(main)> include Magick | |
=> Object | |
[8] pry(main)> ls | |
self.methods: include private public to_s | |
locals: _ _dir_ _ex_ _file_ _in_ _out_ _pry_ | |
[9] pry(main)> ls -g | |
global variables: $! $" $$ $& $' $* $+ $, $-0 $-a $-d $-F $-i $-I $-K $-l $-p $-v $-W $-w $. $/ $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $: $; $< $= $> $? $@ $\ $_ $` $CODERAY_DEBUG $DEBUG $DEBUG_BEFORE $FILENAME $fileutils_rb_have_lchmod $fileutils_rb_have_lchown $KCODE $LOAD_PATH $LOADED_FEATURES $PROGRAM_NAME $SAFE $stderr $stdin $stdout $VERBOSE $~ | |
[10] pry(main)> Image | |
=> Magick::Image | |
[11] pry(main)> |
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
# Heroku Convenience Aliases | |
alias precompile='rake assets:precompile; git add -f public/assets/manifest.yml; git commit -m manifest' | |
alias migrate='heroku run rake db:migrate' | |
alias clear_cache='heroku run rake cache:clear' | |
alias deploy='precompile; git push heroku master; migrate; clear_cache' |
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 'Time' | |
require 'Nokogiri' | |
# | |
# svn-to-git | |
# | |
# Sync an svn repo to git. | |
# | |
# Checks for svn updates. If there are none, does | |
# nothing. Otherwise, commits & pushes the latest |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
contents = File.open('file.txt') { |f| f.read } |
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
with open('file.txt') as f: contents = f.read() |
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
an_array.each { |item| puts item } | |
# or | |
an_array.each do |item| | |
puts item | |
end | |
# or |
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
func(1, 2, 3, 4, 5) | |
# The argument with the "splat operator" denotes | |
# a variable number of arguments which will be | |
# placed into an array. | |
def func(arg1, arg2, *other_args) | |
p arg1.inspect # => 1 | |
p arg2.inspect # => 2 | |
p other_args.inspect # => [3, 4, 5] | |
end |
OlderNewer