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
require 'net/http' | |
require 'json' | |
require 'uri' | |
@token = '' | |
def list_files | |
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago | |
params = { | |
token: @token, |
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
ary = [ | |
1, | |
1, | |
1 | |
] | |
class Array | |
def remove_vals(*vals) | |
out = self.dup | |
__remove_vals(out, *vals) |
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
ary = [ | |
1, | |
1, | |
1 | |
] | |
class Array | |
def remove_vals(*vals) | |
return out if vals.empty? | |
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 Array | |
def except(*e) | |
self - e | |
end | |
end | |
# >> [1, 2, 3].except 2 | |
# => [1, 3] | |
# >> [1, 2, 3].except 3 | |
# => [1, 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
class EmailJob | |
include SuckerPunch::Job | |
def perform(user_id) | |
UserMailer.welcome(user_id).deliver | |
end | |
end | |
module SuckerPunch | |
module Job |
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
<?php | |
$this->path = BASE_FOLDER . '/x/y/z'; | |
if (file_exists($this->path)) { | |
$objects = new RecursiveIteratorIterator ( | |
new RecursiveDirectoryIterator($this->path), | |
RecursiveIteratorIterator::SELF_FIRST); | |
$directories = array(0 => $this->path); |
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
use Rack::Static, | |
urls: { | |
'/': 'index.html' | |
}, | |
root: 'public' | |
run Rack::URLMap.new({ | |
'/': Rack::Directory.new('public') | |
}) |
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
describe "#mentions_story?" do | |
subject { described_class.new(file) } | |
let(:file) { "COMMIT_EDITMSG" } | |
before do | |
File.stub(:read).with(file) { example_commit_message(@relevant_part) } | |
end | |
context "commit message contains the special Pivotal Tracker story syntax" do | |
it "matches just the number" do | |
@relevant_part = "[#8675309]" |
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 PrivacyFilter | |
class << self | |
def filter(controller) | |
@controller = controller | |
first_article?(controller) or administrator?(controller) or user?(controller) | |
end | |
def first_article?(controller) | |
controller.params[:id] == 1 |
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 ApplicationController < (defined?(Rails) && ActionController::Base || Object) | |
end |
NewerOlder