Skip to content

Instantly share code, notes, and snippets.

View devonestes's full-sized avatar

Devon Estes devonestes

View GitHub Profile
@devonestes
devonestes / twitter_pruner.rb
Created March 20, 2018 19:47
Delete your old tweets
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
def collect_with_max_id(collection=[], max_id=nil, &block)
iex(1)> defmodule Tester do
...(1)> defstruct [:first, :second]
...(1)> def foo_to_bar(struct = %{__struct__: struct_module}) do
...(1)> updated_list = struct
...(1)> |> Map.from_struct
...(1)> |> Enum.map(fn({key, value}) ->
...(1)> if value == :foo do
...(1)> {key, :bar}
...(1)> else
...(1)> {key, value}
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '~> 4.2.3'
$(document).ready(function() {
navigator.geolocation.getCurrentPosition(successCallback,errorCallback,options);
});
var weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var dayOfWeekIndex = (new Date()).getDay();
# When we're working with validations in AR, remember that most of them are accepting hashes as arguments.
# For example, we could re-write
validates :email, { :uniqueness => true }
# as
validates(:email, { :uniqueness => true })
# which pretty clearly shows that we have two arguments for the validates method, a symbol and a hash