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
$.fn.extend({ | |
reset: function() { | |
return this.each(function() { | |
$(this).is('form') && this.reset(); | |
}); | |
} | |
}); |
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
... | |
def edit | |
@todo = Todo.find(params[:id]) | |
if @todo.nil? | |
flash[:notice] = "Empty item" | |
redirect_to :action => 'index' | |
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
require 'rubygems' | |
require 'sinatra' | |
require 'whois' | |
require 'json' | |
get '/whois/:domain' do |domain| | |
c = Whois::Client.new | |
r = c.query(domain) | |
puts r | |
r |
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
<?php | |
define("HMAC_ERROR", 1); | |
define("EMAIL_ERROR", 2); | |
define("REQUEST_ERROR", 3); | |
define("POST_ERROR", 4); | |
require_once 'includes/Zend/Loader/Autoloader.php'; | |
Zend_Loader_Autoloader::getInstance(); | |
$response = array("result" => 0, "link" => "", "error" => 0); |
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 Target | |
contruct: (center,radio,points) -> | |
@center = center | |
@radio = radio | |
@points = points | |
isHit: (hit) -> | |
getScore: (hit) -> |
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
su -c grub | |
find /boot/grub/stage1 | |
root (hdX,Y) | |
setup (hdX) |
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
#GET http://0.0.0.0:4567/thumb/https%3a%2f%2ftwimg0-a.akamaihd.net%2fprofile_images%2f1615677010%2f34214a75-4b21-46ae-89b4-2e44e356dc92_normal.png | |
#Sinatra doesn’t know this ditty. | |
#Try this: | |
#get '/thumb/https%3a/twimg0-a.akamaihd.net/profile_images/1615677010/34214a75-4b21-46ae-89b4-2e44e356dc92_normal.png' #do | |
# "Hello World" | |
#end | |
require 'sinatra' |
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
foreach($values as $key=>$val) { | |
if (!isset($values[$key])) { | |
unset($values[$key]); | |
} | |
} |
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 'spec_helper' | |
describe UsersController do | |
describe "User creation" do | |
it "should create a new user" do | |
@user = mock_model(User, | |
:email => '[email protected]', | |
:password => 'test', | |
:name => 'tester', |
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
req = Net::HTTP::Post.new('/api/1.0/messages/send.json', initheader = {'Content-Type' =>'application/json'}) | |
req.body = @request.to_json | |
http = Net::HTTP.new(@uri.host, @uri.port) | |
http.use_ssl = true | |
response = http.start {|http| http.request(req) } | |
puts "Response #{response.code} #{response.message}: #{response.body}" | |
# => Response 500 Internal Server Error: {"status":"error","code":-100,"name":"GeneralError","message":"An unknown error occurred processing your request. Please try again later."} |
OlderNewer