Skip to content

Instantly share code, notes, and snippets.

Will Franzen wtfaremyinitials

Block or report user

Report or block wtfaremyinitials

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View responsive-svg.js
// http://slides.com/sdrasner/svg-can-do-that#/38
var shape = document.getElementById("shape");
// media query event handler
if (matchMedia) {
var mq = window.matchMedia("(min-width: 500px)");
mq.addListener(WidthChange);
WidthChange(mq);
}
@wtfaremyinitials
wtfaremyinitials / MailURLDropView.swift
Created Jul 29, 2017
Accept deep-links to Mail.app messages through macOS drag and drop
View MailURLDropView.swift
// Accept deep-links to Mail.app messages through macOS drag and drop
class MailURLDropView: NSView {
var filePath: String?
required init?(coder: NSCoder) {
super.init(coder: coder)
self.wantsLayer = true
self.layer?.backgroundColor = NSColor.gray.cgColor
View chatdb-schema.txt
$ sqlite3 chat.db '.schema message' | tr ',' '\n'
CREATE TABLE message (ROWID INTEGER PRIMARY KEY AUTOINCREMENT
guid TEXT UNIQUE NOT NULL
text TEXT
replace INTEGER DEFAULT 0
service_center TEXT
handle_id INTEGER DEFAULT 0
subject TEXT
country TEXT
attributedBody BLOB
@wtfaremyinitials
wtfaremyinitials / yr.sh
Last active May 18, 2017
Alternative to `yarn run` that doesn't spin up a node process
View yr.sh
#!/bin/bash
CMD=$(jq -r .scripts.$1 < package.json)
echo -e '\033[37m$ '$CMD'\033[39m'
PATH=$PATH:./node_modules/.bin eval "$CMD"
echo -e '\xe2\x9c\xa8 Done.'
@wtfaremyinitials
wtfaremyinitials / enum_str_repr.rs
Created Jan 17, 2017
Rust enum with str representation
View enum_str_repr.rs
macro_rules! enum_with_str_representation {
(enum $enum_name:ident {
$($variant:ident => $nice_name:expr,)+
}) => {
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
enum $enum_name {
$($variant),+
}
impl ::std::fmt::Display for $enum_name {
View rust-closures.rs
#[cfg(test)]
mod tests {
fn counter() -> Box<FnMut() -> i32 + 'static> {
let mut b = 0;
let ret = move || { b += 1; b };
Box::new(ret)
}
#[test]
View ti84-random.cpp
#include <iostream>
#include <iomanip>
using namespace std;
/*
0: 50
1: 54
3: 57
6: 59
62: 61
@wtfaremyinitials
wtfaremyinitials / pip.js
Created Oct 12, 2016
Open any video in picture-in-picture mode on Safari 10
View pip.js
document.querySelector('video').webkitSetPresentationMode('picture-in-picture')
View apple.txt
_.
_/=\:<
.#/*let}
//as\@#:~/
try()|:-./
*~let:>@{#
<\>}#@~*/
(+!:~/+/
/={+|
_.:+*as=._ _.]@~let[._
@wtfaremyinitials
wtfaremyinitials / osx-console-login.sh
Last active Aug 16, 2016
Enable the ">console" username on OSX/macOS
View osx-console-login.sh
sudo defaults write /Library/Preferences/com.apple.loginwindow.plist "DisableConsoleAccess" NO
You can’t perform that action at this time.