Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq
on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp
# Taps | |
tap 'caskroom/cask' | |
tap 'homebrew/cask-fonts' | |
tap 'homebrew/cask-versions' | |
tap 'homebrew/bundle' | |
## Shell Utilities | |
brew 'coreutils' | |
brew 'zsh' | |
brew 'zsh-completions' |
#!/bin/bash -e | |
# -------------------------------------------------------- | |
# Generate app icons and xcassets file from a single image | |
# Ben Clayton, Calvium Ltd. | |
# https://gist.github.com/benvium/2be6d673aa9ac284bb8a | |
# -------------------------------------------------------- | |
# | |
# Usage with an input of 1024x1024 PNG file | |
# generateAppIcon.sh AppIcon.png |
var Whammy = require('node-whammy'), | |
sharp = require('sharp'); | |
function canvasToWebp(canvas, callback) { | |
sharp(canvas.toBuffer()).toFormat(sharp.format.webp).toBuffer(function(e, webpbuffer) { | |
var webpDataURL = 'data:image/webp;base64,' + webpbuffer.toString('base64'); | |
callback(webpDataURL); | |
}); |
# Towers of Hanoi | |
# | |
# Write a Towers of Hanoi game: | |
# http://en.wikipedia.org/wiki/Towers_of_hanoi | |
# | |
# In a class `TowersOfHanoi`, keep a `towers` instance variable that is an array | |
# of three arrays. Each subarray should represent a tower. Each tower should | |
# store integers representing the size of its discs. Expose this instance | |
# variable with an `attr_reader`. | |
# |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' |
Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq
on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp
#!/usr/bin/env python | |
from flask import Flask, jsonify, request, render_template, abort | |
from text.blob import TextBlob | |
from text.utils import strip_punc | |
app = Flask(__name__) | |
##### TextBlob API ##### | |
@app.route("/api/sentiment", methods=['POST']) | |
def sentiment(): |
function hostReachable() { | |
// Handle IE and more capable browsers | |
var xhr = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" ); | |
var status; | |
// Open new request as a HEAD to the root hostname with a random param to bust the cache | |
xhr.open( "HEAD", "//" + window.location.hostname + "/?rand=" + Math.floor((1 + Math.random()) * 0x10000), false ); | |
// Issue request and handle response |
# add this to your config.rb | |
ready do | |
wikitargets = Hash.new | |
wikiwords = Hash.new | |
sitemap.resources.select {|p| p.ext == ".html" }.each do |p| | |
unless p.data['wikitag'].nil? | |
wikitargets[p.data['wikitag']] = p.url | |
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 |