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 / gist:1999083
Created March 8, 2012 06:07
Git hook to disallow non-fastforward updates (also disallows merges into feature branches in order to keep them cleanly rebaseable)
#!/usr/bin/env ruby
# This update hook enforces the following policies
# 1) release and master branches are fast-forward only
# 2) feature branches cannot contain merges
$refname = ARGV[0]
$oldrev = ARGV[1]
$newrev = ARGV[2]
@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 / 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
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
### 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:

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 / 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
@freshtonic
freshtonic / gist:6579025
Created September 16, 2013 10:33
DRYed up version of the CSS transformations.
# The final CSS files
$(DIST)/stylesheets/%.css: $(SASS)/%.scss
$(BIN)/node-sass $< $@
$(BIN)/autoprefixer --browsers $(AUTOPREFIXER_BROWSERS) $@
@freshtonic
freshtonic / gist:6373145
Last active December 21, 2015 22:09
Failing to install Yeoman (with a clean node installation).
npm http GET https://registry.npmjs.org/yo
npm http 200 https://registry.npmjs.org/yo
npm http GET https://registry.npmjs.org/yo/-/yo-1.0.4.tgz
npm http 200 https://registry.npmjs.org/yo/-/yo-1.0.4.tgz
npm http GET https://registry.npmjs.org/sudo-block
npm http GET https://registry.npmjs.org/open/0.0.4
npm http GET https://registry.npmjs.org/yeoman-generator
npm http GET https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/lodash
@freshtonic
freshtonic / gist:5916602
Created July 3, 2013 09:23
When Pow is failing you, try making a .powrc like this:
export rvm_path=$HOME/.rvm
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ]; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`
fi