Skip to content

Instantly share code, notes, and snippets.

View willrax's full-sized avatar
👨‍💻

Will Raxworthy willrax

👨‍💻
View GitHub Profile
class Client < Android::OS::AsyncTask
def doInBackground(params)
url = Java::Net::URL.new("http://www.bom.gov.au/fwo/IDN60901/IDN60901.94768.json")
reader = Java::IO::BufferedReader.new(Java::IO::InputStreamReader.new(url.openStream))
builder = Java::Lang::StringBuilder.new("")
while ((line = reader.readLine()) != nil) do
builder.append(line)
end
puts builder.toString
def setup_google_services
@google_client = Com::Google::Android::Gms::Common::Api::GoogleApiClient::Builder.new(self)
@google_client.addConnectionCallbacks(self)
@google_client.addApi(Com::Google::Android::Gms::Location::LocationServices::API)
end
@willrax
willrax / Gulpfile.js
Last active August 29, 2015 14:14
Angular, Gulp and a Server
var gulp = require("gulp"),
gutil = require("gulp-util"),
jshint = require("gulp-jshint"),
concat = require("gulp-concat"),
clean = require("gulp-clean"),
connect = require("gulp-connect"),
sourcemaps = require("gulp-sourcemaps"),
bowerPath = "bower_components/";
var bowerComponents = [
@willrax
willrax / ecto-error.sh
Created July 19, 2015 13:19
ecto-error.sh
$ mix ecto.migrate
** (MatchError) no match of right hand side value: %{columns: ["count"], command: :select, num_rows: 1, rows: [[0]]}
(ecto) lib/ecto/adapters/postgres.ex:61: Ecto.Adapters.Postgres.ddl_exists?/3
(ecto) lib/ecto/migration/schema_migration.ex:19: Ecto.Migration.SchemaMigration.ensure_schema_migrations_table!/1
(ecto) lib/ecto/migrator.ex:36: Ecto.Migrator.migrated_versions/1
(ecto) lib/ecto/migrator.ex:134: Ecto.Migrator.run/4
(mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
{{! this example will move the cursor to the end each time
you type, even if you are in the middle of the input value}}
<input value={{inputText}} oninput={{action (mut inputText) value="target.value"}}>
{{! this example wont}}
<input value={{inputText}} onchange={{action (mut inputText) value="target.value"}}>
{{! notice the different events}}
@willrax
willrax / application.controller.js
Last active December 6, 2015 09:26
shared-component-state
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@willrax
willrax / application.controller.js
Last active December 24, 2015 17:32
oneWay WAT
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
name: "ten",
tennison: Ember.Object.create({
name: 'tennison',
friend: Ember.Object.create({
name: 'will'
defmodule Plugger.Mixfile do
use Mix.Project
# Project setup <snip>
def application do
[applications: [:logger, :cowboy, :plug],
mod: {Plugger, []}]
end
defmodule Plugger.Router do
use Plug.Router
plug :match
plug :dispatch
def start_link do
Plug.Adapters.Cowboy.http(Plugger.Router, [])
end
end
defmodule Plugger.Router do
plug Plugger.SayHello, [name: “Will”]
end
defmodule Plugger.SayHello do
def init(opts), do: opts
def call(conn, opts) do
IO.puts opts[:name]
conn