This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⌘ ★ “ ” ‘ ’ ❝ ❞ ✔ × ✖ ✗ ✕ ⓧ ⊗ ⊕ ⊖ ⊙ ⊠ ⊡ ≠ ℻ © ® ← ↑ ↓ → ❮ ❯ ◄ ◂ ▸ ▷ ▹ ⌃ ¹ ² ³ ⁂ ▣ ⬚ Ⓜ ⓜ ⒨ ꟿ ṃ ♻ ♺ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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... | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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} | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
$ = require('jquery') | |
Backbone = require('backbone') | |
Backbone.$ = $ | |
Marionette = require('backbone.marionette') | |
View = require('./view') | |
$ -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# create an insanely tiny placeholder gif | |
# output in base64 | |
# | |
# i'm still working the bytes... so this is | |
# a working proto but it needs to be further | |
# edited... | |
# | |
# as much as possible in accordance to GIF spec. | |
class Dick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# determine if the supplied array is filled with only | |
# numbers. | |
# | |
# App.Util.isArrayNumbers([1,2,3,4,5,6]) | |
# > true | |
# App.Util.isArrayNumbers([1, 2, 3, 4, 5, 6, 'a']) | |
# > false | |
# | |
Util.isArrayNumbers = (arr) -> | |
_.uniq(_.map arr, (num) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reduce an array of numbers and return | |
# the sum | |
Util.reduceAddArray = (arr) -> | |
return unless Util.isArrayNumbers(arr) | |
_.reduce arr, (a, b) -> | |
a + b |
OlderNewer