Skip to content

Instantly share code, notes, and snippets.

generated Dec 22, 2023 15:37:09
system MacOS 14.2 Darwin 23.2.0 arm64 ns
emacs 30.0.50 ~/.emacs.d/
doom 3.0.0-pre PROFILE=_@0 HEAD -> master 03d692f12 2023-12-08 15:11:45 -0500
~/.doom.d/
shell /bin/zsh
features ACL GIF GLIB GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES
NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB
traits gui server-running envvar-file custom-file
generated Oct 19, 2023 14:46:47
system MacOS 13.6 Darwin 22.6.0 arm64 ns
emacs 30.0.50 ~/.emacs.d/
doom 3.0.0-pre PROFILE=_@0 HEAD -> master, origin/master, origin/HEAD 986398504
2023-10-07 02:33:45 +0200 ~/.doom.d/
shell /bin/zsh
features ACL GIF GLIB GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES
NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB
traits gui server-running envvar-file custom-file
> curl "http://whereismypower.co.za/api/get_status"
{"active_stage":2,"active_stage_name":"Stage 2","timestamp":"2015-04-13T15:40:03.873Z"}%
> curl "http://whereismypower.co.za/api/get_schedule?area=5&date=2014-04-13&stage=2"
{"outages":["02:00 - 04:30","18:00 - 20:30"],"area_id":5,"stage":2,"date":"2014-04-13","day_of_month":13}%
// This example demonstrates the following:
// 1) There is some API (modeled as a trait) we want our users to interact with
// 2) Something implements this trait
// 3) It depends on another trait to do some of it's work
// 4) That thing might be expensive and should be shareable across instances of #2
//
// This code compiles (Rust 0.10-pre)
pub trait Magician {
fn do_magic(&self);
> rustc templated-traits.rs
templated-traits.rs:37:5: 37:19 error: type `Client<,ClientConfig>` does not implement any method in scope named `ping`
templated-traits.rs:37 client.ping();
^~~~~~~~~~~~~~
error: aborting due to previous error
@marcbowes
marcbowes / gist:5263592
Last active December 15, 2015 12:58
Ember-data: handling temporary data with non-persistent relationships
{
tops: [{
hostname: "hostname",
load: 10,
processes: [{
name: "ruby",
RSS: 20000
}]
}]
}
@marcbowes
marcbowes / gist:5117577
Created March 8, 2013 16:13
Ember not booting cleanly
DEBUG: -------------------------------
DEBUG: Ember.VERSION : 1.0.0-rc.1
DEBUG: Handlebars.VERSION : 1.0.0-rc.3
DEBUG: jQuery.VERSION : 1.9.1
DEBUG: -------------------------------
TypeError: Application.registerInjection is not a function [Break On This Error]
injection: function(app, stateManager, property) {
@marcbowes
marcbowes / gist:4976522
Last active December 13, 2015 21:18
Failing at ember-rails
git clone https://github.com/marcbowes/ember-hacking.git
bundle
rails s
open http://localhost:3000/
Nothing appears in the console and I get the following error in the console
DEBUG: ------------------------------- ember.js?body=1 (line 339)
DEBUG: Ember.VERSION : 1.0.0-rc.1 ember.js?body=1 (line 339)
@marcbowes
marcbowes / gist:4017369
Created November 5, 2012 14:12
Dedup posters
require "digest/md5"
require "set"
found = Set.new
def md5sum(filename)
content = File.read(filename)
Digest::MD5.hexdigest(content)
end
@marcbowes
marcbowes / gist:2224748
Created March 28, 2012 08:30
Why I didn't spend $480.11 at ThinkGeek (Livechat transcript)
Marc: Hi. I get this error on checkout: Transaction was declined by processor.
Sade: Hi Marc!
Sade: I will look into this
Sade: What is the order number?
Marc: I'm at checkout
Marc: 35246f7e5
Marc: Earlier I tried via PayPal but that order was rejected too :-(
Sade: Hmm, I am seeing that it being rejected by us.
Sade: Is there anyway you can place the order when you get back to the states?
Marc: I don't live in the states