Skip to content

Instantly share code, notes, and snippets.

View wilkie's full-sized avatar
☠️
screaming into the void

wilkie wilkie

☠️
screaming into the void
View GitHub Profile
@wilkie
wilkie / keybase.md
Created September 28, 2017 22:16
keybase proof

Keybase proof

I hereby claim:

  • I am wilkie on github.
  • I am wilkie (https://keybase.io/wilkie) on keybase.
  • I have a public key whose fingerprint is 738A 1D5A FDF6 8DC2 0858 567D C2A2 2FFD 2510 664B

To claim this, I am signing this object:

For uri-identifiers that are non-webfinger identifiers, you'll see people say @wilkie.fyi and this will mean it does discovery by looking at that page and discovering via content negotiation and/or links. This is useful for people who are creating content on sites that doesn't implement webfinger, for instance a blogging or photo posting site. They'll add Link tags instead and use a full URI. Basically: it is eas(ier) to syndicate that content without having to own the domain, but hard to add something to .well-known.

I might be @example.org/wilkie or even, dare I say, @mastodon.social/@wilkie but it will still look like @wilkie to humans. The same methods you are using to disambiguate, but hide the details to human beings, will still work here.

To disambiguate, in AS2, mentions and "hashtags" etc can be parsed universally using tag:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "name": "A thank-you note",
@wilkie
wilkie / 0-description.md
Created October 26, 2014 02:11
This shows you how to handle simple, dynamic colored versions of svg files in ruby + sinatra.

This is an example of how to present a route in Sinatra that returns a colored version of an existing svg. This assumes the first line is the line, which is what inkscape produces. Just drop in any svg, and it will give you one where it is colored in with the given color.

/dynamic/foo.svg returns the normal image.

/dynamic/foo.svg?color=red gives you a red image.

/dynamic/foo.svg?hue=150&sat=50&light=50 gives you a slightly green version of the image.

/dynamic/foo.svg?hex=fff gives a white version of the image.

@wilkie
wilkie / scripts.rb
Last active August 29, 2015 14:04
Prints different things depending on language interpreter.
"<?php error_reporting(E_ALL ^ E_NOTICE); /* \
"; //; # ";
if ("00"==false)
console.log("Hello from JavaScript!");
else // # */
if ("0"==false)
printf("Hello from PHP!\n");
else
printf("Hello from Ruby!\n");
//; end;
@wilkie
wilkie / gist:10cf0cf60f371f680d30
Created May 1, 2014 02:54
Messing with unicode "constants"
# ruby 2.0.0p353
module Kernel
def const_set(sym, value)
if sym.to_s.match /^[^A-Z]/
@@__cool_constants ||= {}
@@__cool_constants[sym] = value
else
super(sym, value)
end
@wilkie
wilkie / example.rb
Created April 22, 2014 00:41
A dynamic natural language translation layer for ruby... an example:
require :spaES # <-- Select the stdlib locale
require 'stdlib' # <-- import the stdlib
# The above will be automatically done in practice, but it is just listed here
# as an illustration. This is because after this point, you need to use the term
# importar to import.
# As in: importar 'some-library'
# Only THIS file uses the function name table in español. Other files and existing libraries
# assuming the original or a different natural language are functionally unaffected. It is
@wilkie
wilkie / 00-description.md
Last active August 29, 2015 13:58
Disrupting ruby naming

Disrupting Ruby Naming

In the source files below, 'slash' means it is in a subdirectory. subdirectories are not allowed in gists. Find the source here

Let's say you, a native Spanish speaker, wanted to write some code and use a library, but you wanted it to be equally functional to a library that already exists, but have Spanish names. So far, our community has been focused on and expecting that everybody learn English. This is enforced in several places, but primarily in our programming languages. Let us be code librarians and ask ourselves: shouldn't we change that?

C

At first, I terrorized C's standard library by replacing the function names with those readable in Spanish. It was a good time.

http://www.daveramsey.com/blog/20-things-the-rich-do-every-day

I love lists! I especially love those that involve both a selection bias AND a confirmation bias!

I especially love the paragraph immediately after the list talking about how the Christian bible discusses how we should "live on less than we make" and instructs us that we should be "saving money and thereby building wealth". What?! God wants me to not be poor?! God should provide me with better health insurance options, a higher minimum wage, more inclusive workers' rights, and better, cheaper access to healthy food options.

  1. 70% of wealthy eat less than 300 junk food calories per day. 97% of poor people eat more than 300 junk food calories per day. 23% of wealthy gamble. 52% of poor people gamble.

The wealthy have better and more convenient access (through wealth and physical location) to large grocery stores.

@wilkie
wilkie / compile.sh
Last active December 21, 2015 01:28
Rust testing micro-framework based off of typical behavior testing frameworks that's a little rough around the edges, but a good example of the power of rust macros.
rustc test.rs && ./test
@wilkie
wilkie / Gemfile
Created July 21, 2013 09:18
Using timezones in Ruby with simply the tzinfo database.
source 'https://rubygems.org'
gem "tzinfo"
gem "tzinfo-data"