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 vimchat
command! w w>>chat|enew!
cabbrev w <c-r>=(getcmdtype()==':' && getcmdpos()==1 ? 'W' : 'w')<CR>
View caps_to_esc.sh
# run at login with `sudo defaults write com.apple.loginwindow LoginHook path/to/caps_to_esc.sh`
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' > /dev/null 2>&1
View macos-hostname-fix.sh
# must be run as root
COMPUTER_NAME=name
scutil --set ComputerName $COMPUTER_NAME
scutil --set HostName $COMPUTER_NAME
scutil --set LocalHostName $COMPUTER_NAME
defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME
View erc20-balance.js
// from: https://medium.com/@piyopiyo/how-to-get-erc20-token-balance-with-web3-js-206df52f2561
let tokenAddress = "REPLACE_WITH_ERC20_TOKEN_ADDRESS";
let walletAddress = "REPLACE_WITH_WALLET_ADDRESS";
// The minimum ABI to get ERC20 Token balance
let minABI = [
// balanceOf
{
"constant":true,
View suspense.js
import React, {
Component,
unstable_ConcurrentMode as ConcurrentMode,
unstable_Suspense as Suspense,
} from 'react'
import { createFetcher } from './cache';
import logo from './logo.svg'
import './App.css'
const URL = 'https://gist.githubusercontent.com/wtfaremyinitials/c7fe964ee2ee2937c0dfaf90dec27f82/raw/9a1f3a31cec8d5250fc8d0c99b152f6054e98aef/foo.json'
View choose_iface.md
@wtfaremyinitials
wtfaremyinitials / notify.js
Created Apr 23, 2015
Desktop notifications in Javascript
View notify.js
function notify(message, iconUrl, onclick) {
if (!Notification) {
alert(message);
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
var notification = new Notification('', {
@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 foo.json
{
"message": "Hello, world!"
}
You can’t perform that action at this time.