Skip to content

Instantly share code, notes, and snippets.

class Array
def except(*e)
self - e
end
end
# >> [1, 2, 3].except 2
# => [1, 3]
# >> [1, 2, 3].except 3
# => [1, 2]
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,