Skip to content

Instantly share code, notes, and snippets.

View Sutto's full-sized avatar

Darcy Laycock Sutto

View GitHub Profile
if defined?(ActionDispatch); begin; ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML); rescue; end; end
if defined?(ActionController::Base) && ActionController::Base.respond_to?(:param_parsers); begin; ActionController::Base.param_parsers.delete(Mime::XML); rescue; end; end
if defined?(ActionDispatch); begin; ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::JSON); rescue; end; end
if defined?(ActionController::Base) && ActionController::Base.respond_to?(:param_parsers); begin; ActionController::Base.param_parsers.delete(Mime::JSON); rescue; end; end
# Darcy's public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAlhcBKPcWKMOVHreqrlSCO5JIKGsmOL30+y/OmqlsbNOHrs0/JpiLpVGowPgAfP02pIjp/GlMFjtfvkgsidXTbkqywZmh45Axh0D5ZmO305N42xTekZ3VJR2x6fn6uZySXrd7GOZIDuQcTsEqsl4wrae1DT66a769RNwYbIRKarBTxlA8C2Zb8I9qvizLg6OV45/Q7vH0TMtQ+3Rfs6GlGJzrbeqH4S8mNzPH9Z9cz2vB+6y0NFBcROT/5xIjFVr0yaKjJiyGOOh/IQZ7aO2pwl/Ozr3vweJ6wTnDCgJ5+5AGLCmzi75JR0f4bEcR+Gt5f4hnOFrOZpM+ppG4Sx4WvQ==
UILocalNotification *localNotification = [UILocalNotification new];
NSDate *dateToFire = [[NSDate date] dateByAddingTimeInterval:2];
localNotification.fireDate = dateToFire;
localNotification.alertBody = @"Time to update your profile";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
@Sutto
Sutto / code.md
Last active December 17, 2015 23:58
Our GovHack Source Code
# First: Product - Default without setting hash defaults:
x = %w(a b c)
h = Hash[x.product([true])]
p h # => {'a' => true, 'b' => true, 'c' => true}
p h['a'] # => true
p h['d'] # => nil
# e.g: sphinx takes a hash of field name -> weight pairs, so we use
def search_weights
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# Uses forman to boostrap ENV from a .env environment.
# This is mostly useful since it means we can then use it from
# things other than foreman (passenger, our own scripts) with easy.
@Sutto
Sutto / resources.md
Last active December 28, 2015 16:19
RailsGirls Perth Post-event links

Keeping on Programming

First, there is an incredible breadth of free and paid online coursework you can use to keep going on. The following list are ones we recommend (as does Rails Girls internationally) that cover most topics you need to actually make something:

  • Codecademy is a great series of interactive tutorials designed to teach you the basics of programming.
  • Try Ruby as you've seen is an introduction to the Ruby language - it assumes some general programming concepts, but it's important to understand Ruby and not just Rails (which sits on top of it).
  • Code.org is an incredible program designed to encourage Computer Science among high school students. I highly suggest checking out their video and their learning page - which links to many online resources that have free programming tutorials.
  • Coursera and Udacity are two online university-style teaching places, wit
class ApiController < RocketPants::Base
# Override the json encoding mechanism to use Oj for mega-speed!
def encode_to_json(json)
Oj.dump json, mode: :compat
end
add_method_tracer :encode_to_json
end
@Sutto
Sutto / about.md
Last active March 31, 2016 00:44
Buildkite Lambda Function

We use this flow with AWS lambda, combined with CloudWatch Scheduled Events, to trigger our builds periodically.

It's nice, avoids duplication and keeps everything together easily.

from urllib.request import Request, urlopen
import ssl
from bs4 import BeautifulSoup
import pandas as pd
url = 'https://www.who.int/emergencies/diseases/novel-coronavirus-2019/media-resources/news'
#################################################
#################################################