I hereby claim:
- I am tekin on github.
- I am tekin (https://keybase.io/tekin) on keybase.
- I have a public key whose fingerprint is FB9F BD4D 775C E14B F481 1BB1 4AB5 9526 95A5 5C7E
To claim this, I am signing this object:
# Stick this in your home directory and point your Global Git config at it by running: | |
# | |
# $ git config --global core.attributesfile ~/.gitattributes | |
# | |
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details | |
*.c diff=cpp | |
*.h diff=cpp | |
*.c++ diff=cpp | |
*.h++ diff=cpp |
I hereby claim:
To claim this, I am signing this object:
tekin@anikulapo:~/projects/crowd.fm$ rake stats | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 922 | 777 | 30 | 123 | 4 | 4 | | |
| Helpers | 190 | 159 | 0 | 23 | 0 | 4 | | |
| Models | 1266 | 978 | 26 | 151 | 5 | 4 | | |
| Libraries | 2691 | 2051 | 23 | 250 | 10 | 6 | | |
| Integration tests | 1112 | 883 | 26 | 3 | 0 | 292 | | |
| Functional tests | 2219 | 1957 | 28 | 18 | 0 | 106 | |
def SomeAuthController < ApplicationController | |
def twitter_auth | |
request_token = twitter_consumer.get_request_token(:oauth_callback => twitter_callback_credentials_url) | |
session['twitter_request_token'] = request_token.token | |
session['twitter_request_secret'] = request_token.secret | |
redirect_to request_token.authorize_url | |
end | |
def twitter_callback |
module AssociationDefaultAttributes | |
def create(attrs, &block) | |
super(default_attributes.merge(attrs), &block) | |
end | |
def build(attrs={}, &block) | |
super(default_attributes.merge(attrs), &block) | |
end | |
end |
class User < ActiveRecord::Base | |
has_many :events, :extend => AssociationDefaultAttributes do | |
def default_attributes | |
{ :venue => proxy_owner.default_venue } | |
end | |
end | |
end | |
module AssociationDefaultAttributes | |
def create(attrs, &block) |
# Author: Ian Moss aka oceanician : http://twitter.com/oceanician | |
# First Published: https://gist.github.com/1009253 | |
# modulus is your friend! this works because of the way ruby | |
# modulus behaves when the dvidend is negative. | |
def friday_after(date) | |
date +(5 -date.cwday) % 7 | |
end | |
# Returns all the Fridays between today and the date specified. |
# install the facebook_api gem first | |
require 'rubygems' | |
require 'facebook_api' | |
FacebookApi.configure do |config| | |
config.api_key = 'API_KEY_HERE' | |
config.secret_key = 'SECRET_KEY_HERE' | |
end | |
event_info = {:name => 'Event name', :start_time => Time.now.to_i}.to_json |
AF: | |
code: AF | |
name: Afghanistan | |
AL: | |
code: AL | |
name: Albania | |
DZ: | |
code: DZ | |
name: Algeria | |
AS: |
def create | |
@credit_card = ActiveMerchant::Billing::CreditCard.new(params[:credit_card]) | |
@billing_address = Address.new(params[:address]) | |
@payment = @order.payments.create(:credit_card => @credit_card, :address => @billing_address) | |
if @payment.success? | |
redirect_to complete_order_url(@order) | |
elsif @payment.requires_authentication? | |
# A view with an iframe from which the user is redirected to the authentication page | |
render :action => 'three_d_iframe' | |
else |