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
# == Paperclip without ActiveRecord | |
# | |
# Simple and lightweight object that can use Paperclip | |
# | |
# | |
# Customized part can be extracted in another class which | |
# would inherit from SimplePaperclip. | |
# | |
# class MyClass < SimplePaperclip | |
# attr_accessor :image_file_name # :<atached_file_name>_file_name |
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 SoftDeletable | |
extend ActiveSupport::Concern | |
def soft_delete! | |
find_each do |record| | |
record.soft_delete! | |
end | |
end | |
included do |
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
uri = URI::HTTP.build( | |
:host => '127.0.0.1', | |
:port => 9393, | |
:path => request.path_info, | |
:query => request.query_string | |
) | |
content_type 'application/json', :charset => 'utf-8' | |
Net::HTTP.get(uri) |
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
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 | |
debug1: Reading configuration data /etc/ssh_config | |
debug1: /etc/ssh_config line 20: Applying options for * | |
debug2: ssh_connect: needpriv 0 | |
debug1: Connecting to 54.88.210.143 [54.88.210.143] port 22. | |
debug1: Connection established. | |
debug3: Incorrect RSA1 identifier | |
debug3: Could not load "/Users/adamrobbie/.ssh/id_rsa" as a RSA1 public key | |
debug1: identity file /Users/adamrobbie/.ssh/id_rsa type 1 | |
debug1: identity file /Users/adamrobbie/.ssh/id_rsa-cert type -1 |
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
defmodule RunLength do | |
def run(string) do | |
compress(String.slice(string, 1..-1), String.slice(string, 0, 1), 1, "") | |
end | |
defp compress("", char, count, result) do | |
result <> Integer.to_string(count) <> char | |
end | |
defp compress(string, char, count, result) do |
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
grep -Ri 'oldprojectame' * | cut -f1 -d':' | sort | uniq |
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
setInterval(function(){ | |
var form = $('#my-form-id'); | |
var method = form.attr('method').toLowerCase(); // "get" or "post" | |
var action = form.attr('action'); // url to submit to | |
$[method](action, form.serialize(), function(data){ | |
// Do something with the server response data | |
// Or at least let the user know it saved | |
}); | |
},10000); |
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
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist && launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist |
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
<div class="wrapper"> | |
<div class="container"> | |
<header> | |
</header> | |
<div id="content"> | |
</div> | |
</div> | |
<div class="footer-push"></div> |
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
function download() { | |
var token = new Date().getTime(); | |
var wait = document.getElementById("wait"); | |
wait.style.display = "block"; | |
var pollDownload = setInterval(function() { | |
if (document.cookie.indexOf("download=" + token) > -1) { | |
document.cookie = "download=" + token + "; expires=" + new Date(0).toGMTString() + "; path=/"; | |
wait.style.display = "none"; | |
clearInterval(pollDownload); |
OlderNewer