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
#!/usr/bin/env ruby | |
def padded_tweet(message) | |
if message.size >= 140 | |
message[0..139] | |
elsif %w{. ! ? …}.include? message[-1] | |
message.ljust(140, message[-1]) | |
else | |
message.ljust(140, '!') | |
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
#!/usr/bin/env ruby | |
def padded_tweet(message) | |
if message.size >= 140 | |
return message[0..139] | |
end | |
dup = message.dup | |
if %w{. ! ? …}.include? message[-1] | |
return dup.ljust(140, message[-1]) | |
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
class Follow < ActiveRecord::Base | |
belongs_to :follower, class_name: 'User' | |
belongs_to :followee, class_name: 'User' | |
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
.bundle |
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
threads 0, Integer(ENV['MAX_THREADS'] || 10) | |
on_restart do | |
defined?(ActiveRecord::Base) and | |
ActiveRecord::Base.connection.disconnect! | |
FB::RedisPool.shutdown | |
end | |
workers Integer(ENV['WEB_CONCURRENCY'] || 3) |
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
function todo { | |
vim ~/Dropbox/todos/$1.txt | |
} | |
function list-todo { | |
for i in ~/Dropbox/todos/*; do echo $(basename $i | cut -f 1 -d '.') ":" $(wc -l < $i); done | |
} | |
alias t='todo' | |
alias lt='list-todo' |
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
{ '@tadas_t' => ' 124553, | |
'@chrisbelpaire' => ' 124744, | |
'@floris' => ' 124798, | |
'@chucky4711' => ' 124960, | |
'@mr_foto' => ' 125077, | |
'@deogracia_974' => ' 125132, | |
'@christophePhilemotte' => ' 125267, | |
'@beanieboi' => ' 125469 } |
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
ls . | xargs -I file vim -d file /comparable_folder/file |
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 SuggestedUsers | |
attr_reader :user, :options | |
def initialize(user, options = nil) | |
@user = user | |
@options = options || {} | |
end | |
def suggested_users | |
User.joins('JOIN follows as follows_follows ON follows_follows.followee_id = users.id') |
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 SuggestedUsers | |
attr_reader :user | |
def initialize(user) | |
@user = user | |
end | |
def suggested_users | |
User.joins('JOIN follows as follows_follows ON follows_follows.followee_id = users.id') | |
.joins('JOIN follows as user_follows ON follows_follows.follower_id = user_follows.followee_id') |