$ rails g model User
belongs_to
has_one
import reddit, getpass | |
if __name__ == "__main__": | |
r = reddit.Reddit(user_agent="test") | |
user_name = raw_input("User name: ") | |
password = getpass.getpass("Password: ") | |
r.login(user=user_name,password=password) | |
saved_links = r.get_saved_links() | |
for link in saved_links: | |
print "Title: " + link.title |
/** | |
* Circular Tooltip (SO) | |
* http://stackoverflow.com/q/13132864/1397351 | |
*/ | |
* { margin: 0; padding: 0; } | |
body { | |
overflow: hidden; | |
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg); | |
} | |
/* generic styles for button & circular menu */ |
/** | |
* Circular Tooltip (SO) | |
* http://stackoverflow.com/q/13132864/1397351 | |
*/ | |
* { margin: 0; padding: 0; } | |
body { | |
overflow: hidden; | |
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg); | |
} | |
/* generic styles for button & circular menu */ |
http://guides.rubyonrails.org/migrations.html
def icon(name, size=1) | |
#icon("camera-retro") | |
#<i class="icon-camera-retro"></i> | |
html = "<i class='icon-#{name}' " | |
html += "style='font-size:#{size}em' " | |
html += "></i>" | |
html.html_safe | |
end | |
collection_action :download_report, method: :get do | |
users = User.where('created_at >= ?', Date.today - 1.month) | |
csv = CSV.generate( encoding: 'Windows-1251' ) do |csv| | |
# add headers | |
csv << [ #Some header ] | |
# add data | |
users.each do |user| | |
csv << [ user.created_at ] | |
end | |
end |
# Currently, there isn't an automatic method for doing this, | |
# but with a little code in your `.zshrc` file, you can configure it. | |
function code { | |
if [[ $# = 0 ]] | |
then | |
open -a "Visual Studio Code" | |
else | |
local argPath="$1" | |
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}" |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |