Skip to content

Instantly share code, notes, and snippets.

View mattosborn's full-sized avatar

Matt Osborn mattosborn

View GitHub Profile
@mattosborn
mattosborn / init.vim
Created October 18, 2018 03:12
vimcfg
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype typescript setlocal ts=2 sts=2 sw=2
autocmd Filetype tsx setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
autocmd Filetype json setlocal ts=2 sts=2 sw=2
autocmd Filetype css setlocal ts=2 sts=2 sw=2
autocmd Filetype scss setlocal ts=2 sts=2 sw=2
autocmd Filetype sass setlocal ts=2 sts=2 sw=2
set relativenumber
@mattosborn
mattosborn / config.tsx
Created October 18, 2018 03:10
onivim config
import * as React from "react";
import * as Oni from "oni-api";
export const activate = (oni: Oni.Plugin.Api) => {
console.log("config activated");
// Input
//
// Add input bindings here:
//
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
console.log( web3.eth.getBlock('latest') );
@mattosborn
mattosborn / debounce.js
Created November 12, 2015 13:40 — forked from danprince/debounce.js
Debounce
function debounce(fn, interval) {
var lastCall;
return function() {
var now = Date.now();
if(!lastCall || now - lastCall > interval) {
fn.apply(this, arguments);
lastCall = now;
}
@mattosborn
mattosborn / .screenrc
Last active June 14, 2017 22:14
screen config
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
function throttle(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
if (!options) options = {};
var later = function() {
previous = options.leading === false ? 0 : Date.now();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
javascript: (function() {
var scripts = [
'https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.6.0/lodash.js'
];
function drop(url) {
var s=document.createElement('script');
s.setAttribute('src', url);
document.getElementsByTagName('body')[0].appendChild(s);
console.log('loaded', url);
@mattosborn
mattosborn / spacefinder-debug-bookmarklet.js
Created December 10, 2014 14:01
spacefinder-debug-bookmarklet
javascript: (function() {
var script = document.createElement('script');
script.src = "https://s3-eu-west-1.amazonaws.com/aws-frontend-store/MATT/spacefinder-debug.js";
document.getElementsByTagName('head')[0].appendChild(script);
})();
@mattosborn
mattosborn / spacefinder-debug.js
Last active August 29, 2015 14:11
spacefinder-debug.js
(function() {
require([
'common/utils/$',
'common/utils/detect',
'common/modules/article/spacefinder',
'common/modules/commercial/article-body-adverts'
], function(
$,
detect,
@mattosborn
mattosborn / gist:e80fb368ec0ff6ffce83
Created November 3, 2014 14:54
log cutting n counting
cat logfile.log | awk -F'" "' '{print $6}' | sort | uniq -c | sort -rbg | less