Skip to content

Instantly share code, notes, and snippets.

@jkap
jkap / full-width drafts.js
Created June 6, 2016 17:11
put this in a drafts action to replace yr draft with its full-width equivalent
function fullWidth(input) {
var
dict = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}",
offset = 65281,
out = "",
n,
letter,
codePoints = [],
index;
@jkap
jkap / pronouns.twee
Last active August 29, 2015 14:28
Pronoun Macro for Twine 1
:: Start
Your story will display this passage first. Edit it by double clicking it.
WHAT DO YOU WANT TO BE CALLED
[[PLEASE CALL ME 'SHE'|NextPage][$pnoun_choice = "she"]]
[[MALE PRONOUNS FOR DAYS WHAT WHAT|NextPage][$pnoun_choice = "he"]]
[[CALM THE FUCK DOWN ALL CAPS BOI YOU WILL REFER TO ME WITH THE MODERN 'THEY', WHICH WILL DRIVE PEDANTS MAD WHICH HONESTLY IS WORKING AS INTENDED|NextPage][$pnoun_choice = "they"]]
@jkap
jkap / ngBlink.js
Created March 4, 2014 15:29
Blink for Angular
@jkap
jkap / Res.sh
Last active December 20, 2015 08:39 — forked from Garland-g/Res.sh
#!/bin/bash
#Original author: Travis Gibson
#Modified for the Chromebook Pixel by Josh Kaplan
#This script requires an argument for the resolution width
if [ -z "$1" ]; then
echo "Usage: Res.sh <resolution_width>";
exit 1;
fi
erg=$( echo "$1")
check=$(xrandr -q | grep eDP1 | cut -d " " -f 3 | cut -d "x" -f 1)
@jkap
jkap / giveaway.rb
Last active November 8, 2018 02:15
A quick script I wrote to help pick a winner for a friend's tumblr giveaway
require 'tumblr_client'
Tumblr.configure do |config|
config.consumer_key = "conumer_key"
config.consumer_secret = "consumer_secret"
config.oauth_token = "oauth_token"
config.oauth_token_secret = "oauth_token_secret"
end
client = Tumblr::Client.new
posts = client.posts("blog", id: id, notes_info: true)
notes = posts["posts"].first["notes"]
password
@jkap
jkap / gist:2901697
Created June 9, 2012 16:38
fsbext diff for homebrew
diff --git a/fsbext.c b/fsbext.c
index e643fca..4cbe027 100755
--- a/fsbext.c
+++ b/fsbext.c
@@ -1978,7 +1978,7 @@ void put_extension(u8 *fname, u8 *ext, int skip_known) {
experimental_extension_guessing(fname, oldext_buff, fname + strlen(fname));
if(oldext_buff[0]) {
strcpy(wavext + 1, ext);
- } else if(!stricmp(wavext + 1, ext)) {
+ } else if(!strcasecmp(wavext + 1, ext)) {
@jkap
jkap / chef_solo_bootstrap.sh
Created June 4, 2012 23:26 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git-core
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@jkap
jkap / chef_solo_bootstrap.sh
Created June 4, 2012 23:26 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
/**
Returns the nesting level
-1 if not in a ul
0 if root
>0 if nested
*/
function detectNesting(selector, count) {
if(!count) { var count = -1; }
if ($(selector).parent().is("ul"))
{