Skip to content

Instantly share code, notes, and snippets.

View moimikey's full-sized avatar
:shipit:
ship it

Michael Scott Hertzberg moimikey

:shipit:
ship it
View GitHub Profile
@moimikey
moimikey / konami.coffee
Last active December 29, 2015 03:19
KONAMIIIIIIIIIIII KYYYYAHHHHHHHHHHHHH!!!!
@MM.module 'EasterEggApp', (EE, App, Backbone, Marionette, $, _) ->
# up, up, down, down, left, left, right, right, a, enter
EE.sequence = [38, 38, 40, 40, 37, 37, 39, 39, 65, 13]
EE.pressed = []
EE.on
'start': ->
$(window).on 'keyup.konami', EE.pressedKey
'stop': ->
$(window).off '.konami'
<script src="components/get-style-property/get-style-property.js"></script>
<script src="components/get-size/get-size.js"></script>
<script src="components/matches-selector/matches-selector.js"></script>
<script src="components/eventEmitter/EventEmitter.js"></script>
<script src="components/eventie/eventie.js"></script>
<script src="components/doc-ready/doc-ready.js"></script>
<script src="components/classie/classie.js"></script>
<script src="components/jquery-bridget/jquery.bridget.js"></script>
<script src="components/outlayer/item.js"></script>
<script src="components/outlayer/outlayer.js"></script>
@moimikey
moimikey / upgrade.sh
Created December 24, 2013 05:23
my ever growing update bash function
function update() {
echo — Updating Homebrew...
brew update
echo — Upgrading Homebrew packages...
brew upgrade
echo — Cleaning up...
brew cleanup
echo - Pruning...
brew prune
echo — Updating MacPorts...
@moimikey
moimikey / pricechecker.coffee
Last active January 4, 2024 20:12
Neopets.com SDB Price Checker
# This is best when used in conjunction with the Injector chrome extension:
# http://neocotic.com/injector
#
# Add this snippet of code and launch Chrome or Canary in no sec mode:
#
# alias chrome-nosec="open /Applications/Google\ Chrome.app --args --disable-web-security --disable-prompt-on-repost"
# alias canary-nosec="open /Applications/Google\ Chrome\ Canary.app --args --disable-web-security --disable-prompt-on-repost"
#
# Then pretty much just keep your dev console open and everytime you visit a page in the SDB, the code will
# automatically reach out to the JellyNeo item database and tell you if anything in your SDB is worth over x nps.
Util.encodeRFC5987 = (string) ->
encodeURIComponent(string)
# Note that although RFC3986 reserves "!", RFC5987 does not,
# so we do not need to escape it
.replace(/['()]/g, escape)
.replace(/\*/g, '%2A')
# The following are not required for percent-encoding per RFC5987,
# so we can allow for a little better readability over the wire: |`^
.replace(/%(?:7C|60|5E)/g, unescape)
 ⌘ ★ “ ” ‘ ’ ❝ ❞ ✔ × ✖ ✗ ✕ ⓧ ⊗ ⊕ ⊖ ⊙ ⊠ ⊡ ≠ ℻ © ® ← ↑ ↓ → ❮ ❯ ◄ ◂ ▸ ▷ ▹ ⌃ ¹ ² ³ ⁂ ▣ ⬚ Ⓜ ⓜ ⒨ ꟿ ṃ ♻ ♺
# Hide elements via selectors.
#
# Works wonderfully to block facebook ads which are
# pre-loaded ;o zomg
#
# Probably won't often update this gist, but selectors
# simply need to be added to @patterns
#
# You can avoid the transpile if you run this using
# the Injector, chrome extension. s'what I use.
# Converts a data image uri to canvas image
#
# reader = new FileReader()
# reader.onload = (evt) =>
# App.Util.dataToCanvas evt, el: @ui.thumb, width: 80, height: 40
# reader.readAsDataURL(...)
#
# @ui.thumb = jquery selector
# ultimately the jquery dependency can be 86ed from this...
#
# Returns an object with a new width and height
# constraining the proportions of the given max width
# and max height
#
# examples:
# Util.scaleProportion(200, 200, 2000, 2000);
# > Object {width: 200, height: 200}
# scaleProportion(200, 200, 2582, 2394)
# > Object {width: 200, height: 185}
#
# Convert int|float from seconds into formatted
# duration timestamp
#
# deps: underscore or lodash or any other library
# that takes over window._ and provides a
# #.compact() method. dep could ultimately
# be removed...
#
# uses double bitwise not `~~` as `Math.floor`
# uses `+` as type coercion to `int`