Displays last 30 day sales for Gumroad on Dashing. Doesn't use API since the data doesn't appear to be provided.
Set GUMROAD_USERNAME
qnd GUMROAD_PASSWORD
enviroment variable.
In your view:
<%= link_to "Load more", posts_path(@posts, page: @posts.current_page+1), id: "load-more-posts", remote: true %>
In your controller:
respond_to :html, :js, only: [:index]
def index
<!-- country codes (ISO 3166) and Dial codes. --> | |
<select name="countryCode" id=""> | |
<option data-countryCode="GB" value="44" Selected>UK (+44)</option> | |
<option data-countryCode="US" value="1">USA (+1)</option> | |
<optgroup label="Other countries"> | |
<option data-countryCode="DZ" value="213">Algeria (+213)</option> | |
<option data-countryCode="AD" value="376">Andorra (+376)</option> | |
<option data-countryCode="AO" value="244">Angola (+244)</option> | |
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option> | |
<option data-countryCode="AG" value="1268">Antigua & Barbuda (+1268)</option> |
This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:
*nix
based command prompt (but not the default Windows Command Prompt!)cd ~/.ssh
. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\
on Windows).ssh
folder, there should be these two files: id_rsa
and id_rsa.pub
. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls
to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa
and id_rsa.pub
in order for Git, GitHub, and BitBucket to recognize them by default.ssh-keygen -t rsa -C "your_email@example.com"
. ThThere are many ways to detect browser agent, it could be front-end side with Javascript or backend. In this short tutorial, I'll walk you through on how to detect browser version with Ruby On Rails
This applies for Rails > 2.x
When you surf the site, your browser name and versions are stored in HTTP_USER_AGENT
in the request. We need to process this string to work out the browser version and name to decide to greet viewers with warning text or not.
# gem install crack rest-client fastercsv | |
require 'rubygems' | |
require 'crack' | |
require 'rest_client' | |
require 'fastercsv' | |
# To use, get an access token here, by clicking "get access token" | |
# and checking user.groups in the dialog box | |
# https://developers.facebook.com/tools/explorer?method=GET&path=209024949216061%2Ffeed | |
# |
namespace :db do desc "Backup database to AWS-S3" | |
task :backup => [:environment] do | |
datestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S") | |
backup_filename = "#{Rails.root.basename}-#{datestamp}.sql" | |
db_config = ActiveRecord::Base.configurations[Rails.env] | |
# process backup | |
`mysqldump -u #{db_config['username']} -p#{db_config['password']} -i -c -q #{db_config['database']} > tmp/#{backup_filename}` | |
`gzip -9 tmp/#{backup_filename}` | |
puts "Created backup: #{backup_filename}" |
AF,Africa,6255146 | |
AS,Asia,6255147 | |
EU,Europe,6255148 | |
NA,North America,6255149 | |
OC,Oceania,6255151 | |
SA,South America,6255150 | |
AN,Antarctica,6255152 |
<html> | |
<head> | |
<script type="text/javascript" src="jquery-1.8.1.min.js"></script> | |
<script type="text/javascript"> | |
<!-- use the url that your twitter widget is using to retrieve the tweet data --> | |
$(function() { | |
$.getJSON("http://cdn.syndication.twimg.com/widgets/timelines/246079887021051904?dnt=true&domain=unquietcode.com&lang=en&callback=?", function(data) { | |
var tweets = $(data.body).find('li.tweet'); |
$.getScript = function(url, callback, cache){ | |
$.ajax({ | |
url: url, | |
dataType: 'script', | |
success: callback, | |
cache: cache | |
}); | |
}; |