Skip to content

Instantly share code, notes, and snippets.

View blakejakopovic's full-sized avatar

Blake Jakopovic blakejakopovic

View GitHub Profile
@neophit
neophit / Useful Keyboard Text Shortcuts.applescript
Last active July 7, 2019 12:01
Add useful keyboard text shortcuts for exponents and fractions to your System Preferences. With iCloud enabled, these shortcuts will sync with your iOS devices. Tested on OS X 10.9.1 and iOS 7.0.4. Requires GUI Scripting Access: http://support.apple.com/kb/HT5914 (Based partially on this script: https://gist.github.com/Zettt/7724258)
set clickDelay to 0.3
set textReplaceList to {}
set exponentsListName to "Exponents (replaces ^0-^9 with ⁰-⁹)"
set fractionsListName to "Fractions (replaces 1/2-7/8 with ½-⅞)"
set exponentsList to {{"^0", "⁰"}, {"^1", "¹"}, {"^2", "²"}, {"^3", "³"}, {"^4", "⁴"}, {"^5", "⁵"}, {"^6", "⁶"}, {"^7", "⁷"}, {"^8", "⁸"}, {"^9", "⁹"}}
set fractionsList to {{"1/2", "½"}, {"1/3", "⅓"}, {"1/4", "¼"}, {"1/5", "⅕"}, {"1/6", "⅙"}, {"1/7", "⅐"}, {"1/8", "⅛"}, {"1/9", "⅑"}, {"1/10", "⅒"}, {"2/3", "⅔"}, {"2/5", "⅖"}, {"3/4", "¾"}, {"3/5", "⅗"}, {"3/8", "⅜"}, {"4/5", "⅘"}, {"5/6", "⅚"}, {"5/8", "⅝"}, {"7/8", "⅞"}}
set chosenLists to (choose from list {exponentsListName, fractionsListName} with title "Useful Keyboard Text Shortcuts" with prompt "Choose one or more sets of keyboard text shortcuts to add to your System Preferences.
This may take a minute to complete." OK button name "Add text shortcuts" cancel button name "Cancel" default items {exponentsListName, fractionsListName} with multiple selections allowed)
@yieldthought
yieldthought / .screenrc
Created November 11, 2011 10:42
My .screenrc
#
# Example of a user's .screenrc file
#
# This is how one can set a reattach password:
# password ODSJQf.4IJN7E # "1234"
# no annoying audible bell, please
vbell on
@msgodf
msgodf / rickshaw-full-demo.cljs
Created January 18, 2014 20:26
Full Rickshaw Example in Clojurescript
;; Original example (in Javascript) at: http://code.shutterstock.com/rickshaw/examples/lines.html
(def graph-with-legend
(let [series-data (array (array) (array) (array))
random (Rickshaw.Fixtures.RandomData. 150)]
(dotimes [i 150]
(.addData random series-data))
(doto
(Rickshaw.Graph. (clj->js {:element (.getElementById js/document "chart")
:renderer "line"
:width 960
@hmcfletch
hmcfletch / ColorHelper.h
Created January 23, 2012 05:59
A bunch of objective-c color helpers
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
// generate a UIColor from rgb and alpha values
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define RGB(r, g, b) RGBA(r, g, b, 1.0)
// generate a UIColor
#define GRAYSCALEA(rgb, a) RGBA(rgb, rgb, rgb, a)
#define GRAYSCALE(rgb) GRAYSCALEA(rgb, 1.0)
// generate a UIColor from a hex and an alpha value
@jimtla
jimtla / underscoreR.coffee
Created May 6, 2012 21:51
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"
@sashazykov
sashazykov / bitcoin_address_validator.rb
Created January 9, 2013 09:04
Rails 3 bitcoin address validator. Validator syntaxis: validates :address, :bitcoin_address => true, :presence => true
require 'digest'
class BitcoinAddressValidator < ActiveModel::EachValidator
def validate_each(record, field, value)
unless value.blank? || valid_bitcoin_address?(value)
record.errors[field] << "Bitcoin address is invalid"
end
end
private
@shripadk
shripadk / gist:652819
Created October 29, 2010 03:10
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@supermarin
supermarin / dash_emoji_snippets.sql
Last active January 30, 2020 19:58
Emoji in realtime with Dash.app Thanks @orta for putting this up. Read below for importing instructions
INSERT INTO 'snippets' ('title', 'body') VALUES
(':+1:', '👍'),
(':-1:', '👎'),
(':100:', '💯'),
(':1234:', '🔢'),
(':8ball:', '🎱'),
(':a:', '🅰'),
(':ab:', '🆎'),
(':abc:', '🔤'),
(':abcd:', '🔡'),
#GUID Settings
$guidChangePassword = new-object Guid ab721a53-1e2f-11d0-9819-00aa0040529b
$guidLockoutTime = new-object Guid 28630ebf-41d5-11d1-a9c1-0000f80367c1
$guidPwdLastSet = new-object Guid bf967a0a-0de6-11d0-a285-00aa003049e2
$guidComputerObject = new-object Guid bf967a86-0de6-11d0-a285-00aa003049e2
$guidUserObject = new-object Guid bf967aba-0de6-11d0-a285-00aa003049e2
$guidLinkGroupPolicy = new-object Guid f30e3bbe-9ff0-11d1-b603-0000f80367c1
$guidGroupPolicyOptions = new-object Guid f30e3bbf-9ff0-11d1-b603-0000f80367c1
$guidResetPassword = new-object Guid 00299570-246d-11d0-a768-00aa006e0529
@ranieuwe
ranieuwe / grab-azure-docs.sh
Last active March 28, 2020 16:31
Grabs a PDF copy of all Azure docs
for row in $(curl https://api.github.com/repositories/72685026/contents/articles | jq -c -r '.[] | select(.type | contains("dir")) | "\(.name)"'); do wget -O "${row}.pdf" "https://docs.microsoft.com/en-us/azure/opbuildpdf/${row}/toc.pdf?branch=live"; done