This file contains hidden or 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
Nokogiri::CSS.xpath_for('#foo') |
This file contains hidden or 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
server_url= "http://127.0.0.1:4723/wd/hub" | |
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => { | |
platform: 'Mac', | |
app: 'safari', | |
device: 'iPad Simulator', | |
# version: '7.0', | |
}, | |
:url => server_url ) |
This file contains hidden or 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
# https://sites.google.com/site/jimmyxu101/testing/use-tcpdump-to-monitor-http-traffic | |
tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' |
This file contains hidden or 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
# Current path should have VIDEO_TS directory | |
# | |
mkisofs -dvd-video -o ~/Desktop/back-to-the-future.iso . |
This file contains hidden or 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
fernyb@fernyb-SD30V10:~/sources$ wodim --devices | |
wodim: Overview of accessible drives (1 found) : | |
------------------------------------------------------------------------- | |
0 dev='/dev/sg0' rwrw-- : 'TSSTcorp' 'CDDVDW SH-S203B' | |
------------------------------------------------------------------------- | |
wodim dev=/dev/sg0 -v -data ~/the-dictator.iso |
This file contains hidden or 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
skatr_development=# \d spots | |
Table "public.spots" | |
Column | Type | Modifiers | |
-------------+-----------------------------+---------------------------------------------------- | |
id | integer | not null default nextval('spots_id_seq'::regclass) | |
ALTER SEQUENCE spots_id_seq RESTART WITH 1; |
This file contains hidden or 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
git rm $(git ls-files --deleted) |
This file contains hidden or 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
# Get file mime type using command line | |
file --mime-type -b Transcodez-license.transcodez |
This file contains hidden or 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
@response = ActiveSupport::JSON.decode(@data.body) |
This file contains hidden or 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
#validates :email, :presence => true, :email => true | |
require 'mail' | |
class EmailValidator < ActiveModel::EachValidator | |
def validate_each(record,attribute,value) | |
begin | |
m = Mail::Address.new(value) | |
# We must check that value contains a domain and that value is an email address | |
r = m.domain && m.address == value | |
t = m.__send__(:tree) |