Skip to content

Instantly share code, notes, and snippets.

ary = [
1,
1,
1
]
class Array
def remove_vals(*vals)
return out if vals.empty?
ary = [
1,
1,
1
]
class Array
def remove_vals(*vals)
out = self.dup
__remove_vals(out, *vals)
@coreyhaines
coreyhaines / slack_delete.rb
Created August 21, 2016 02:08 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
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,
@coreyhaines
coreyhaines / some_spec.rb
Created March 20, 2012 23:44 — forked from stevenharman/some_spec.rb
Using Rspec's "let" inside an "it" block. Crazy? Yes. Useful? Occasionally.
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]"