Skip to content

Instantly share code, notes, and snippets.

View mtso's full-sized avatar
shipping

Matthew mtso

shipping
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mtso on github.
  • I am mtso (https://keybase.io/mtso) on keybase.
  • I have a public key whose fingerprint is 12C2 545D 6A9E D9CA 0E05 863A E2E2 68A1 AEBC DC78

To claim this, I am signing this object:

@mtso
mtso / neonriot.css
Created September 24, 2016 08:31
My Flarum's custom CSS shim.
/*
Main color: #00BF93 / #00917E
2ndary color: #4D698E
*/
@import 'https://fonts.googleapis.com/css?family=Ubuntu';
<!DOCTYPE html>
<html>
<head>
<style>
body {
padding: 10em;
}
.tsukkomi-enabled {
/*margin: 10em;*/
@mtso
mtso / .gitconfig
Created December 4, 2016 09:25 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
// rot13Reader's `Read([]byte) (int, error)` implementation
// following the go tool tour
// mtso, 2016
// would be interesting to try a ternary with:
// https://play.golang.org/p/ZgLwC_DHm0
package main
import (
"io"
@mtso
mtso / pic.go
Created December 14, 2016 21:10
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct {
w int
@mtso
mtso / crawler.go
Last active December 16, 2016 07:19
// My primitive solution to the web crawler exercise in the go tool tour
// Definitely need more practice on concurrency patterns and error package usage
//
// After much frustration, I ended up peeking at the official solution:
// https://github.com/golang/tour/blob/master/solutions/webcrawler.go
// so, I stole these ideas:
// the use of a concurrent closure
// iterating through the done channel
package main
@mtso
mtso / throttle.js
Last active March 1, 2017 06:16
A JavaScript throttling function.
module.exports = function(callback, threshold) {
var isReady = true;
var onceMore = false;
var context;
var args;
function trigger() {
isReady = false;
callback.apply(context, args);
setTimeout(refresh, threshold);
}
@mtso
mtso / index.html
Last active March 3, 2017 08:37
sago prototype
<!doctype html>
<html>
<body>
<script>
function readSago(src) {
return new Promise(function(resolve, reject) {
var rawFile = new XMLHttpRequest();
rawFile.open('GET', src, false);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 &&
@mtso
mtso / frequencySort.js
Created March 6, 2017 00:13
451. Sort Characters By Frequency: Given a string, sort it in decreasing order based on the frequency of characters.
/**
* @param {string} s
* @return {string}
*/
var frequencySort = function(s) {
var map = {};
s.split('').forEach(function(char) {
map[char] = map[char] ? map[char] + 1 : 1;
});
map = getEntries(map).sort(function(a, b) {