Skip to content

Instantly share code, notes, and snippets.

View freshtonic's full-sized avatar
🎯

James Sadler freshtonic

🎯
  • Sydney, Australia
View GitHub Profile
@freshtonic
freshtonic / Weird.swift
Created May 5, 2020 11:47
Only runs first Future
public func setupScript(tag: NFCISO7816Tag) -> AnyPublisher<CommandResult, Error> {
return Deferred { Future<CommandResult, Error> { promise in
print("C 1");
tag.sendCommand(apdu: commandWriteDataUrlTemplate(), completionHandler: commandCallback(promise))
}}.flatMap { _ in
return Deferred{ Future<CommandResult, Error> { promise in
print("C 2");
tag.sendCommand(apdu: commandAuthenticateEV2FirstPart1(), completionHandler: commandCallback(promise))
}
}}.flatMap { result in
### Keybase proof
I hereby claim:
* I am freshtonic on github.
* I am jamessadler (https://keybase.io/jamessadler) on keybase.
* I have a public key ASCaW7V7UqcYddWNCXlnwJRNKUn84kkndYCwPCXD586iFwo
To claim this, I am signing this object:
This preso made CRDTs really click for me
- http://richard.dallaway.com/crdt/
But only after reading this paper which describes a CRDT imlemented as a tree of edits.
- https://hal.inria.fr/file/index/docid/445975/filename/icdcs09-treedoc.pdf
Grokking how conflict resolution is determined is key I think. The CRDT will hold every party's

Plain dough

Makes 170g dough (enough for one 30 cm pizza)

  • 1 teaspoon dried yeast
  • 1 teaspoon salt
  • 100 ml warm water
  • 2 teaspoons olive oil, plus extra, for greasing
  • 160 g plain (all-purpose) flour, sifted
@freshtonic
freshtonic / Gemfile.lock
Created April 29, 2015 04:15
There's a line of cocaine in my Gemfile.lock
paperclip (2.5.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
cocaine (>= 0.0.2)
@freshtonic
freshtonic / score.rs
Created January 28, 2015 12:52
I started porting @garybernhardt's "selecta" to Rust as a learning exercise. This is my attempt so far.
extern crate regex;
extern crate core;
use std::str;
use std::slice::SliceConcatExt;
use self::core::str::StrExt;
use self::regex::Regex;
use std::num::ToPrimitive;
@freshtonic
freshtonic / gist:072f7fec12f0b221d0b0
Created June 24, 2014 04:57
Show the services, factories, filters, directives, controllers etc exported by an angular module (by regexing the source)
#!/usr/bin/env ruby
# Reads your JS on STDIN, minified JS is OK as angular methods names should be preserved.
# The reason this exists is because I was getting an erroroneous error message about missing
# module 'ngLocale', but googling that indicated that it really meant that one of my dependencies
# was unresolved. A change to the JS concatenation had caused this error.
# In order to resolve the error I wrote a script to parse the old minified and new minified JS to dump
# declared services to STDOUT. I could then see what was missing.
@freshtonic
freshtonic / keybase.md
Created March 18, 2014 10:34
keybase.md

Keybase proof

I hereby claim:

  • I am freshtonic on github.
  • I am jamessadler (https://keybase.io/jamessadler) on keybase.
  • I have a public key whose fingerprint is F8E7 54C6 DEF1 9E63 1532 B955 81DD 8C74 7C2A 25B7

To claim this, I am signing this object:

@freshtonic
freshtonic / pre-commit
Last active December 4, 2021 10:33
Git commit hook to abort commits when I accidentally commit dumb shit.
#!/usr/bin/env ruby
# Checks for things that I often commit accidentally and bails out of the
# commit. To skip this pre-commit hook use `git commit --no-verify`.
checks = [
/\bddescribe\b/,
/\biit\b/,
/\bxit\b/,
/binding.pry/,
@freshtonic
freshtonic / gist:6974873
Last active December 25, 2015 12:09
Nokogiri <pre>, serialize() and whitespace failing spec
require 'spec_helper'
def serialize(thing, format=:as_html)
case thing
when Nokogiri::HTML::Document
document.serialize(:encoding => 'UTF-8') do |config|
config.format.send format
end
when Nokogiri::HTML::DocumentFragment
thing.serialize