Skip to content

Instantly share code, notes, and snippets.

View ksloan's full-sized avatar
🐛
Bug hunting

Kevin Sloan ksloan

🐛
Bug hunting
View GitHub Profile
@ksloan
ksloan / convert_psd_to_png.sh
Created July 12, 2016 06:33
convert all psd in current dir to pngs using convert
for f in `ls *.psd`
do
convert "${f}[0]" `echo $f | sed 's/.psd/.png/'`
done
@ksloan
ksloan / nginx_static_proxy
Created November 14, 2015 15:28
Nginx proxy config that serves static files
server {
listen 80;
server_name ksloan.net;
root /home/kevin/app/public;
location / {
try_files $uri @backend;
}
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@ksloan
ksloan / gist:d5ec0249589a1eaa3b36
Created December 1, 2014 14:05
jQuery plugin to fade out element after certain amount of time
$.fn.flash = function(dur) {
var $el = this;
setTimeout(function() {
$el.fadeOut('slow', function() {
$el.remove()
})
}, dur)
}
// example: fade out after 5 seconds
@ksloan
ksloan / gist:f2c663db4c8d941cb1da
Created December 1, 2014 14:04
jQuery plugin to turn form in JSON
$.fn.form2JSON = function() {
var data = {}
this.serializeArray().map(function(item) {
data[item.name] = item.value;
});
return data
}
// use like this
var data = $form.form2JSON()
@ksloan
ksloan / tweet_image.js
Created November 7, 2014 00:19
simplest image/media tweet with node
var request = require('request')
var tweet_image = function(status, imgUrl, done) {
var url = 'https://api.twitter.com/1.1/statuses/update_with_media.json'
var req = request.post(url, {
oauth: {
consumer_key: this.oauth.consumer_key,
consumer_secret: this.oauth.consumer_secret,
token: this.oauth.access_token,
@ksloan
ksloan / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
#core_tooltip {
left: 1000px;
top: 430px;
@ksloan
ksloan / uri.js
Created August 25, 2014 01:47 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ksloan
ksloan / gist:d1b9ace61fddd2356ebf
Last active September 11, 2024 18:42
CSS Color Definitions for Font-Awesome Social Icons
.fa-facebook, .fa-facebook-square {
color: #3b5998
}
.fa-twitter, .fa-twitter-square {
color: #00aced
}
.fa-google-plus, .fa-google-plus-square {
color: #dd4b39
}
.fa-youtube, .fa-youtube-play, .fa-youtube-square {
@ksloan
ksloan / gist:e8c84d57944526f21181
Created July 10, 2014 21:43
disable jquery mobile list text truncation
.ui-btn-text {
white-space: normal;
}