Skip to content

Instantly share code, notes, and snippets.

{
"app/assets/javascripts/models/*.js": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.js",
"template": "App.%S = DS.Model.extend"
},
"app/assets/javascripts/controllers/*_controller.js": {
"command": "jcontroller",
"alternate": "spec/javascripts/controllers/%s_spec.js",
@tonywok
tonywok / jsbin.osuXiBa.html
Last active December 27, 2015 13:09
Ember pattern for binding your data to other data conditionally. Useful when you have lots of properties following a naming convention that need to be copied and/or updated dependent on state. (E.g copying address to billing/shipping address)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
</head>
<body>
<script type="text/x-handlebars">
@tonywok
tonywok / acronym.exs
Created April 7, 2017 17:41
acronym.exs
module Acronym
def abbreviate(string) do
string
|> String.codepoints
|> Enum.with_index
|> Enum.reduce("", fn({letter, idx}, acronym) ->
cond do
String.upcase(letter) == letter and String.downcase(letter) != letter ->
acronym <> letter
String.at(string, idx-1) == " " ->
@tonywok
tonywok / rpn.rb
Created October 13, 2018 17:33
Toy RPN Expression Evaluator
require "forwardable"
class Operator
# TODO: probably raise if stuff isn't implemented
# TODO: probable register implementations
end
class Operand
# TODO: probably raise if stuff isn't implemented
# TODO: probable register implementations
@tonywok
tonywok / dag_spike.rb
Created February 13, 2019 13:55
dag-spike
require "tsort"
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'pry'
gem 'pry-byebug'
end

Keybase proof

I hereby claim:

  • I am tonywok on github.
  • I am tonywok (https://keybase.io/tonywok) on keybase.
  • I have a public key ASBcoIdY2d_xFoFbXJyD0jt9pJCvZj3e2lIltd14lQcLKQo

To claim this, I am signing this object:

@tonywok
tonywok / first_class_command_notes.rb
Last active January 19, 2021 10:17
First Class Commands Ruby Notes
# https://raganwald.com/2016/01/19/command-pattern.html
class State
attr_reader :history, :future
attr_accessor :text
def initialize(text)
@history = []
@future = []
@text = text
@tonywok
tonywok / postgressql_db_adapter.rb
Last active May 27, 2021 10:14
PostgresSQL Async DB Adapter
gem "db"
gem "db-postgres"
gem "thread-local"
require "db"
require "db/postgres"
require "active_record/connection_adapters/postgresql_adapter"
module ActiveRecord
# NOTE: This is the active record connection entry point.
# This method is called internally based on the adapter specified in database.yml
@tonywok
tonywok / stolen-laptop.md
Last active October 21, 2021 06:35
Preparing for your laptop to be stolen

Preparing for your Laptop to be stolen by some Asshole

Note, at the time of writing this, I use a mac. Adjust to your preference.

Assumptions

If you're reading this and haven't done these things, and your laptop is still in your possession. Stop everything and do them now.

  1. You have an encrypted hard drive (e.g FileVault)
@tonywok
tonywok / sorcery-cards-2022-03-30.csv
Created March 30, 2022 21:32
Incomplete Sorcery TCG cards
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
name,card_type,rarity,image_url,initial_life,rules_box,type_line,mana_cost,element,earth_threshold,fire_threshold,water_threshold,wind_threshold,power,artist,set_identifier,flavor_text
Unland Eel,minion,ordinary,"https://static.wixstatic.com/media/965b5c_e7cafce2a0b74891a23c78cadf248c38~mv2.png/v1/fill/w_846,h_1182,al_c,usm_0.66_1.00_0.01,enc_auto/965b5c_e7cafce2a0b74891a23c78cadf248c38~mv2.png",,"**Submerge**, **Waterbound**
This Eel gains +2 power when attacking as it surfaces.",An Ordinary Beast of the deadly depths,2,water,,,1,,2,Francesca Baerald,1,
Unravel,magic,ordinary,"https://static.wixstatic.com/media/965b5c_e9547880aa9e4807b5453683d002fe67~mv2.png/v1/fill/w_846,h_1182,al_c,usm_0.66_1.00_0.01,enc_auto/965b5c_e9547880aa9e4807b5453683d002fe67~mv2.png",,Destroy target Relic or Undead minion.,Ordinary Magic of rot and rebirth,1,water,,,1,,,Severine Pineaux,1,"For life to rise, the dead must crumble."
Tide Naiads,minion,exceptional,"https://static.wixstatic.com/media/965b5c_796dab1d1f9b4eedb938817ee887d