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 MyApp::FailureApp < Devise::FailureApp | |
def respond | |
if api_token_failure? | |
invalid_token | |
elsif api_login_failure? | |
invalid_credentials | |
else | |
super | |
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
<html> | |
<head> | |
<script src="../javascripts/d3.v2.min.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
var g = d3.select("body").data([1,2,3,4]); | |
g.enter().append("p"); | |
</script> | |
</head> | |
<body> | |
</body> |
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
u = User.new(:name => "Borris Yeltzin", :date_of_birth => Date.today - 20.years, :ssn => "1234") | |
=> #<User id: nil, email: nil, name: "Borris Yeltzin", crypted_password: nil, salt: nil, claimable: true, date_of_birth: "1992-10-29", ssn: "1234", created_at: nil, updated_at: nil> | |
[4] pry(main)> u.save | |
(0.2ms) BEGIN | |
SQL (2.8ms) INSERT INTO "users" ("claimable", "created_at", "crypted_password", "date_of_birth", "email", "name", "salt", "ssn", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["claimable", true], ["created_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00], ["crypted_password", nil], ["date_of_birth", Thu, 29 Oct 1992], ["email", nil], ["name", "Borris Yeltzin"], ["salt", nil], ["ssn", "1234"], ["updated_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00]] | |
(0.3ms) COMMIT | |
=> true | |
[5] pry(main)> u.update_attributes(:email => "borris.yeltzin@example.com", :password => "f00bar", :password_confirmation => "f00bar") | |
(0.2ms) BEGIN | |
(0.3ms) ROLLBACK |
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
curl -X GET http://localhost:9200/gig_tracks/track/_search -d ' | |
{ filter: | |
{ has_child: | |
{ type: gig_track, | |
filter: | |
{ geo_distance: | |
{ location : | |
{lat: 33, lng: -118}, | |
distance: 100mi | |
} |
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
source :rubygems | |
gem 'yajl-ruby' |
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
<html> | |
<body> | |
<div id="fb-root"></div> | |
<script> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId : '721489701236648', | |
status : true, | |
xfbml : true | |
}); |
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
[ | |
{"Year":"2018","Make":"Cadillac","Model":"CT6","Styling":"6","Acceleration":"4","Handling":"5","Fun Factor":"4","Cool Factor":"4","Weekend Score Total":"23","Features":"9","Comfort":"8","Quality":"8","Practicality":"5","Value":"7","Daily Score Total":"37","Total Score":"60","Video Link":"23:47","Filmed At City":"Tustin","Filmed At Country":"California","Vehicle Country":"USA","id":117}, | |
{"Year":"2018","Make":"Bugatti","Model":"Chiron","Styling":"9","Acceleration":"10","Handling":"9","Fun Factor":"10","Cool Factor":"10","Weekend Score Total":"48","Features":"6","Comfort":"5","Quality":"7","Practicality":"1","Value":"6","Daily Score Total":"25","Total Score":"73","Video Link":"35:06","Filmed At City":"Toronto","Filmed At Country":"Ontario","Vehicle Country":"France","id":1}, | |
{"Year":"2019","Make":"BMW","Model":"i8 Roadster","Styling":"7","Acceleration":"7","Handling":"7","Fun Factor":"6","Cool Factor":"7","Weekend Score Total":"34","Features":"7","Comfort":"6","Quality":"7","Practicality":"2","Value":"6 |
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 'json' | |
def recover_bucket(bucket) | |
list = `aws s3api list-object-versions --bucket #{bucket} --output json --query 'DeleteMarkers[?IsLatest==\`true\`].[Key, VersionId]'` | |
pairs = JSON.parse(list) | |
pairs.each do |(key, versionId)| | |
STDOUT.puts `aws s3api delete-object --bucket #{bucket} --key #{key} --version-id #{versionId}}` | |
end | |
end |
OlderNewer