create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
require 'csv' | |
def memstats | |
size = `ps -o size= #{$$}`.strip.to_i | |
end | |
memstats | |
test = CSV.read('test.csv', headers: true) | |
test.count{|v| v['any_column'] = ~/any_text_in_that_column_to_search/} | |
memstats |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS | |
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing). | |
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here: | |
* Heroku Hostname SSL | |
* GoDaddy Standard SSL Certificate | |
* Zerigo DNS |
public String demoMethod(List<NameValuePair> params) { | |
String args = params.get(1).toString(); | |
String lineEnd = "\r\n"; | |
String twoHyphens = "--"; | |
String boundary = "goBonziteam"; | |
/*int bytesRead, bytesAvailable, bufferSize; | |
byte[] buffer; | |
int maxBufferSize = 1*1024*1024; | |
File temp_file = new File("foo.txt");*/ | |
HttpsURLConnection conn; |
require "net/http" | |
require "uri" | |
require 'json' | |
# Token used to terminate the file in the post body. Make sure it is not | |
# present in the file you're uploading. | |
BOUNDARY = "goBonziteam" | |
JSON_RESPONSE = ActiveSupport::JSON.decode('{ | |
"args": { | |
"values": { |
csv_string = FasterCSV.generate do |csv| | |
csv << ["Idea Name","Total Votes count","Date Created","Created By"] | |
csv << [@idea.title, @idea.votes.size,@idea.created_at.strftime("%B %d, %Y"),@idea.created_by] | |
csv << ["Months","Total Votes count"] | |
votes_count.each_with_index do |i,j| | |
csv << [month_names[j] , votes_count[j] ] | |
end |
require "csv" | |
require "fileutilities" | |
csv_data = File.Read("#{Rails.public_path}/location_of_csv_inside_your_public_dir.csv") | |
csv = CSV.parse(csv_data,:headers => false) | |
csv.each do |row| | |
puts row.inspect | |
age = AgeGroup.find_by_name(row[2]) | |
category = CategoryFlag.find_by_name(row[4]) if row[5] == "flag" | |
category = CategoryTackle.find_by_name(row[4]) if row[5] == "tackle" | |
Drill.create(:name => row[0], :age_group_id =>age.id,:category_id=>category.id,:game_type=>row[5],:file=>row[6]) |
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
class ExampleController < ActionController::Base | |
def create | |
Example.create(sanitized_params) | |
end | |
def update | |
Example.find(params[:id]).update_attributes!(sanitized_params) | |
end | |
protected |