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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GEO</title> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
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 'tempfile' | |
require 'net/http' | |
require 'digest/md5' | |
file = Tempfile.new('temp_file') | |
begin | |
Net::HTTP.start("domain.tld") { |http| | |
resp = http.get("/02185773dcb5a468df6b.pdf") | |
file.write(resp.body) |
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 'digest/md5' | |
require 'aws/s3' | |
#set your AWS credentials | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'XXX', | |
:secret_access_key => 'XXX' | |
) | |
#get the S3 file (object) |
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
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
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
#!/bin/bash | |
# Best use case is to create a file "update_local_db.sh" in your project folder and then call the command with bash update_local_db | |
# Follow me: @jackkinsella | |
function LastBackupName () { | |
heroku pgbackups | tail -n 1 | cut -d"|" -f 1 | |
} | |
# This part assumes you have a low limit on no. of backups allowed |
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
# test by running: | |
# ruby lazy.rb | |
# use control+c to exit | |
require 'amatch' | |
include Amatch | |
def lazy input, matches, abbreviations=true | |
# setup the Levenshtein comparator | |
distances = {} | |
m = Levenshtein.new(input) |
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 'HTTParty' | |
require 'terminal-display-colors' | |
require 'json' | |
# set your endpoints! | |
endpoints = { | |
"Google" => "http://google.com", | |
"Twitter" => "http://twitter.com" | |
} | |
# seconds to sleep between pings |
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
def shift_hsv(startHue,nColors,ii) | |
((360 * (ii - 1)/nColors) + startHue) % 360 | |
end |
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
function colors = linesUM(nColors,onlySecondary) | |
if ~exist('nColors','var') | |
nColors = Inf; | |
end | |
if ~exist('onlySecondary','var') | |
onlySecondary = false; | |
end | |
% maize & blue + BRIGHT colors, n=8 | |
primaryUMcolors = [254 202 48;... |
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
function cb = cbAside(ax,labelText,cbColor,caxisVals) | |
cbOffset = .001; | |
cb = colorbar(ax,'Location','east'); | |
% % cb.FontSize = 8; | |
gcaPos = ax.Position; | |
cbPos = cb.Position; | |
set(cb,'position',[gcaPos(1) + gcaPos(3) + cbOffset gcaPos(2) cbPos(3)/2 gcaPos(4)]); | |
set(cb,'YAxisLocation','right'); | |
cb.Color = 'r'; |
OlderNewer