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
# All the files that match with 'coverage' and tell git to use the branch we're on currenthl (ours, opposed to theirs) | |
git status | grep coverage | sed 's/.*: \(.*\)/\1/g' | xargs git checkout --ours |
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
http://jaketrent.com/post/pagination-headers-with-kaminari/ | |
https://developer.github.com/v3/#pagination | |
Kaminari provides easy pagination in a rails app. It’s great to use. We’ll make it better by adding a little function to your controllers to provide useful pagination headers. | |
kaminari pagination | |
Pagination from Kaminari |
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
rsync -avzP -e "ssh -i /home/user/my.pem" [email protected]:/home/ubuntu/remote-dir /home/user/local-dir |
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 search the commit log (across all branches) for the given text: | |
git log --all --grep='my commit message' | |
To search the actual content of commits through a repo's history, use: | |
git grep 'my commit message' $(git rev-list --all) |
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 start_listener() | |
uri = URI.parse(ENV["REDISCLOUD_URL"]) | |
redis = Redis.new(host: uri.host, port: uri.port, password: uri.password) | |
Thread.new do | |
begin | |
redis.subscribe("__keyevent@0__:expired") do |on| | |
on.subscribe do |channel, subscriptions| | |
puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)" | |
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
Obtrusive: | |
link_to 'Another link with obtrusive JavaScript', '#', | |
:onclick => 'alert("Please no!")' | |
Unobtrusive: | |
rails: | |
link_to 'Link with unobtrusive JavaScript', |
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
$('.removeItem').click(function (event) { | |
if (confirm('Are you sure you want to delete this?')) { | |
$.ajax({ | |
url: 'myUrl', | |
type: "POST", | |
data: { | |
// data stuff here | |
}, | |
success: function () { | |
// does some stuff here... |
NewerOlder