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
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
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
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); |
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
Person = { | |
instance: function(name, lastname) | |
{ | |
var base = this; | |
base._private = {} | |
base._public = {} | |
base._private.name = name; | |
base._private.lastname = lastname; |
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 FilePosition: | |
def __init__(self, bufferId): | |
self.bufferId = bufferId #sets the bufferId | |
self.filePositions = [] # where the modified lines will be stored | |
self.lastPos = 0 | |
self.counter = 0 | |
def addFilePosition(self, pos): | |
self._findDelete(pos) # checks if the line number is already in the list |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
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
#!/usr/bin/env ruby | |
# Full Contol on Ethnet, IP & TCP headers. Play with it ;) | |
# to test it: nc -lvp 4444 | |
# as root: tcpdump -nvvvv 'tcp port 4444' -i wlan0 # change wlan0 to your interface | |
# or use packetfu to monitor as tcpdump | |
## cap = PacketFu::Capture.new(:iface => 'wlan0' , :promisc=> true) | |
## cap.show_live(:filter => 'tcp and port 4444') | |
# libpcap should be installed | |
# gem install pcaprub packetfu |
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 from: http://snipplr.com/view/37063/ | |
include Rails.application.routes.url_helpers | |
# set host in default_url_options: | |
default_url_options[:host] = "localhost" | |
# can then use: | |
url_for() |
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
# in controller | |
# for local files | |
send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
# for remote files | |
require 'open-uri' | |
url = 'http://someserver.com/path/../filename.jpg' | |
data = open(url).read | |
send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |
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
module TableHelpers | |
VALID_FORMATS = [:html, :text] | |
# Find a table on the page and convert it to an array of arrays. | |
# | |
# selector_or_node - A String CSS selector to find the table, or a | |
# Nokogiri::XML::Node object (if you already have a | |
# reference to the table). | |
# options - Optional hash: | |
# columns - An Integer or Range of Integers. Lets you |
OlderNewer