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
f you installed postresql on your server then just host: localhost to database.yml, I usually throw it in around where it says pool: 5. Otherwise if it's not localhost definitely tell that app where to find its database. | |
development: | |
adapter: postgresql | |
encoding: unicode | |
database: kickrstack_development | |
host: localhost | |
pool: 5 | |
username: kickrstack | |
password: secret |
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
result = client.execute(:api_method => api_method, :parameters => { | |
'ids' => "ga:7174565581", | |
'start-date' => Date.new(1970,1,1).to_s, | |
'end-date' => Date.today.to_s, | |
'dimensions' => 'ga:pagePath', | |
'metrics' => 'ga:pageviews', | |
'filters' => 'ga:pagePath==/url/to/user' | |
}) | |
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
Add these lines into ~/.gitconfig file. | |
--------------------------------------------------------------------- | |
[alias] | |
st = status | |
ft = fetch | |
ci = commit | |
cm = commit -m | |
br = branch |
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
/* | |
Add following in /home/usernam/.config/sublime-text-3/Packages/User/RubyTest.sublime-settings | |
If file not present then create one | |
in case you get errors like this | |
ruby:1: Invalid char `\x7F' in expression | |
ruby:1: Invalid char `\x01' in expression | |
ruby:1: Invalid char `\x01' in expression | |
ruby:1: Invalid char `\x01' in expression | |
ruby:1:in `<main>': uninitialized constant ELF (NameError) |
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
process :get_geometry | |
def geometry | |
@geometry | |
end | |
def get_geometry | |
if (@file) | |
img = ::Magick::Image::read(@file.file).first | |
@geometry = [ img.columns, img.rows ] | |
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
# spec/factories/my_files.rb | |
FactoryGirl.define do | |
factory :my_file do | |
photo Rack::Test::UploadedFile.new(File.open(File.join(Rails.root, '/spec/fixtures/myfiles/myfile.jpg'))) | |
end | |
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
Push Notification with AWS SNS Service | |
Prerequisites | |
1. Amazon account | |
2. Note Down the Amazon access_key_id, secret_access_key and region | |
3. Create an Application in Amazon/SNS Section | |
4. Note Down the Application Platform ARN | |
5. Set ENV variables: | |
ENV['SNS_APP_ARN'] = the arn obtained from 4th step | |
ENV['AWS_ACCESS_KEY_ID'] = obtained from step 2 |
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
FormValidator = function(form){ | |
this.forms = form || $("form[data-validate=true]"); | |
this.setDefaults = function(){ | |
$.validator.setDefaults({ | |
errorElement: "span" | |
}) | |
$.extend(jQuery.validator.messages, { | |
required: "Mandatory Field" | |
}) | |
} |
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
class City < ActiveRecord::Base | |
def self.top_cities(order_by) | |
@top_cities ||= Hash.new do |h, key| | |
h[key] = where(top_city: true).order(key).to_a | |
end | |
@top_cities[order_by] | |
end | |
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
/* Magic Script. But the question is, will this work? :3 FUCK YEAH IT DID, FGT! */ | |
function getMyToken() { | |
var cookies = " " + document.cookie, | |
cookieName = "aid"; | |
var index = cookies.indexOf(" " + cookieName + "="); | |
if (index == -1) { | |
index = cookies.indexOf(";" + cookieName + "="); | |
} | |
if (index == -1 || cookieName == "") { |
OlderNewer