Skip to content

Instantly share code, notes, and snippets.

View WillsonSmith's full-sized avatar

Willson Smith WillsonSmith

View GitHub Profile
@WillsonSmith
WillsonSmith / ScreenShot.rb
Created August 14, 2014 23:06
Move screenshots from whatever directory you are currently in into a temp folder. (ie, "cd ~/desktop" "ruby ScreenShot.rb")
require 'fileutils'
files = Dir.glob "*.png"
files = files.map { |file| [file.count("?/"), file] }
files = files.sort.map { |file| file[1] }
files.each do |file|
rena = file.include? 'Screen Shot'
dchk = 'temp'
if rena

Keybase proof

I hereby claim:

  • I am WillsonSmith on github.
  • I am willson (https://keybase.io/willson) on keybase.
  • I have a public key whose fingerprint is 2B19 85F6 768C 3D27 AD37 A65B 0533 4FB0 0C20 304F

To claim this, I am signing this object:

function checkIfNew(tagName, cb) {
"use strict";
var nodeList = document.getElementsByTagName(tagName);
var tempList = [].slice.call(nodeList);
function conditional() {
var tempLength = tempList.length,
nodeLength = nodeList.length,
@WillsonSmith
WillsonSmith / gulpfile.js
Created March 26, 2015 14:59
gulpfile for es6 transpiling with babeljs
var gulp = require("gulp");
var babel = require("gulp-babel");
var sourcemaps = require("gulp-sourcemaps");
gulp.task("default", function () {
return gulp.src("es6.js")
.pipe(babel())
.pipe(gulp.dest("dist"));
});
@WillsonSmith
WillsonSmith / calculate.js
Created April 6, 2015 17:38
do the maths
(function() {
"use strict";
var calculatorPrototype = {
total: 0,
add: function add(number) {
@WillsonSmith
WillsonSmith / inheritedCalculator.js
Last active August 29, 2015 14:18
do the more maths from base
(function() {
"use strict";
var assign = require("lodash.assign"),
mathPrototype = {
total: 0,
add: function add(number) {
@WillsonSmith
WillsonSmith / moveScreenshots.rb
Created July 11, 2015 19:43
Small script to move screenshots from your desktop to a "screens" folder (mac)
require "fileutils"
##moves files including "Screen Shot" to a temp folder
PATH = ARGV[0] ? ARGV[0] : Dir.home() + "/desktop"
TEMP_FOLDER = "screens"
Dir.chdir(PATH)
Dir.mkdir(TEMP_FOLDER) unless Dir.exists?("#{PATH}/#{TEMP_FOLDER}")
FileUtils.mv Dir.glob("Screen Shot*.png"), TEMP_FOLDER
puts ["all finished 😊", "bye bye screenshots! 👋", "nice clean desktop! 💻"].sample
@WillsonSmith
WillsonSmith / shout.js
Last active January 24, 2016 01:28
implementations of some string stuff
(function() {
function compose(...funcs) {
return function (value) {
return funcs.reverse().reduce(function(previous, current) {
return previous.call(this, current(value));
});
};
}
function shout(string) {
@WillsonSmith
WillsonSmith / slackzoom.lua
Created December 1, 2016 20:45
a hammerspoon config to zoom slack on a larger monitor
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
-- window management
-- animation set 0 for instant sizing
hs.window.animationDuration = 0
function windowOrder()
local KEYBOARD_MODIFIER = {'cmd', 'alt', 'shift'}
function getPos()
local win = hs.window.focusedWindow()