This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
import React from 'react'; | |
import { | |
View, | |
Image, | |
ListView, | |
ScrollView, | |
Text, | |
TouchableHighlight, | |
TouchableNativeFeedback, |
#!/bin/bash | |
awk=$(which awk || echo 'missing: install awk' && exit 1) | |
# update apt | |
sudo apt-get update | |
# get ssl related packages from simulated upgrade | |
sudo apt-get upgrade -s | grep ssl | grep Inst | $awk '{print $2}' | xargs -t sudo apt-get install |
#!/usr/bin/env bash | |
# HubCrypt | |
# ======== | |
# | |
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl + | |
# your SSH keys). It needs the private key that matches your last public key | |
# listed at github.com/<user>.keys | |
# |
# A queue that you can pass to IO.select. | |
# | |
# NOT THREAD SAFE: Only one thread should write; only one thread should read. | |
# | |
# Purpose: | |
# Allow easy integration of data-producing threads into event loops. The | |
# queue will be readable from select's perspective as long as there are | |
# objects in the queue. | |
# | |
# Implementation: |
error do | |
exception = request.env['sinatra.error'] | |
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV']) | |
erb :five_hundred | |
end |
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
require 'mechanize' | |
require 'logger' | |
require 'date' | |
## Call: | |
## $ ruby export.rb <gmail> <password> | |
caFile = File.join(File.dirname(__FILE__), 'cacert.pem') | |
if not File.exists? caFile | |
require 'net/http' |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer