Skip to content

Instantly share code, notes, and snippets.

View amundo's full-sized avatar
🫥
(0)

Patrick Hall amundo

🫥
(0)
  • Massachusetts
  • 19:13 (UTC -12:00)
View GitHub Profile
@amundo
amundo / playClip.js
Created September 1, 2012 08:18
playClip
HTMLAudioElement.prototype.playClip = function(startTime, stopTime) {
var video = this;
var playTime = stopTime - startTime;
this.currentTime = startTime;
setTimeout(function(){ video.pause() }, playTime * 1000);
this.play();
}
>>> import unicodedata
>>> unicodedata.name(u"\u026c\u02bc")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: need a single Unicode character as parameter
>>> unicodedata.name(u"\u026c")
'LATIN SMALL LETTER L WITH BELT'
>>> unicodedata.name(u"\u02bc")
'MODIFIER LETTER APOSTROPHE'
initialize: function(){
_.bindAll(this, 'sentenceKeyup', 'transliterate', 'createOnEnter' );
sentences.bind('add', this.addOne, this);
sentences.bind('reset', this.addAll, this);
sentences.bind('all', this.render, this);
sentences.fetch();
@amundo
amundo / sentence.js
Created September 9, 2012 19:22
trying to make a nested collection
window.show = function(o){ return JSON.stringify(o, null,2)}
app = {};
app.Word = Backbone.Model.extend({
})
app.Words = Backbone.Collection.extend({
model: app.Word,
Emoji cheat sheet
Emoji emoticons are supported on Campfire, GitHub, Basecamp, Turntable.fm, and Teambox.
However some of the emoji codes are not super easy to remember, so here is a little cheat sheet.
✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.
People
:bowtie:
:smile:
@amundo
amundo / how_to_save_this.js
Created September 30, 2012 23:42
wondering about top-level persistence of a netsted object in backbone
TextCollection = Backbone.Collection.extend({
model: Text,
localStorage: new Backbone.LocalStorage('textCollection') // i only want to persist here
})
Text = Backbone.Model.extend({
initialize: function(options){
this.set('sentenceCollection', new SentenceCollection())
}
})
@amundo
amundo / find_reduplication.py
Created November 27, 2012 19:36
Finding reduplicated words in a wordlist
#!/usr/bin/env python
from collections import Counter
"""
If the median frequency of the letters in a word is 2,
there's a good chance it's reduplicated
This code is released into the public domain.
Please use it for good not evil kthx.
@amundo
amundo / index.html
Created December 18, 2012 06:21 — forked from mbostock/.block
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>OMG Particles!</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.25.0"></script>
<style type="text/css">
body {
background: #222;
@amundo
amundo / elan.js
Last active December 14, 2015 09:08
i'm trying to load a json file with some metadata in it
var Metadata = function(){
this.files = [];
this.load = function(){
//console.log('this.load…');
$.getJSON(
"metadata.json",
this.store
@amundo
amundo / _.md
Created March 21, 2013 20:22
unit circle