Skip to content

Instantly share code, notes, and snippets.

View tpgmartin's full-sized avatar

Tom Martin tpgmartin

View GitHub Profile
@gabrielhpugliese
gabrielhpugliese / meteor_ytapi.js
Created September 7, 2013 21:17
Snippet for using Google Youtube APIs with Meteor rendering engine (not Meteor UI). Assume the template is called "channel". You only need to implement onPlayerReady of line 44. It uses jQuery.getScript();
Meteor.startup(function () {
Session.set('YTApiReady', false);
Session.set('channelRendered', false);
});
onYouTubeIframeAPIReady = function() {
Session.set('YTApiReady', true);
};
Template.channel.created = function () {
@nickbalestra
nickbalestra / Dialogue.js
Created November 4, 2016 15:31
MVI pattern using redux-like actions/reducer
import xs from 'xstream';
import {div, button} from '@cycle/dom'
function view(state$) {
const vtree$ = state$.map( state =>
div([
button('.increase', 'Moar'),
button('.decrease', 'Less'),
div(`Count: ${state.count}`)
])
import numpy as np
def ptb_iterator(raw_data, batch_size, num_steps, steps_ahead=1):
"""Iterate on the raw PTB data.
This generates batch_size pointers into the raw PTB data, and allows
minibatch iteration along these pointers.
Args:
raw_data: one of the raw data outputs from ptb_raw_data.
batch_size: int, the batch size.
num_steps: int, the number of unrolls.
@foca
foca / stateful.js
Created August 25, 2012 08:23
Stateful is a simple implementation of the State Pattern for JavaScript.
// Stateful is a simple implementation of the state pattern for javascript.
//
// Read more on this design pattern here:
// -> http://sourcemaking.com/design_patterns/state
//
// Initialize Stateful by passing it an object, the name of the initial state
// (defaults to "default"), and an optional hash of interfaces that will be
// applied for each state. If these interfaces are not passed, they default to
// the object's constructor's States property. So, for example:
//
@ebidel
ebidel / Web Components Resources.md
Last active February 27, 2023 22:04
List of resources related to Web Components
@fasiha
fasiha / README.md
Last active April 7, 2023 14:15
How Anki calculates intervals

Reading _nextRevIvl and its subfunction _constrainedIvl plus _rescheduleLapse will illuminate how Anki calculates the due date (the “interval”) of a flashcard, based on whether you answer

  • 1 (fail)
  • 2 (pass but hard)
  • 3 (pass)
  • 4 (pass and easy)

This is more of a self-note, so I assume you’ve read the Anki manual top-to-bottom a couple of times.

Let d >= 0, “delay”, be the days between the due date and the date you actually reviewed. This can be important because if you successfully answer a flashcard a long time after it was due for study, that means you probably know it really well.

@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@kolber
kolber / pandoras_vox.mdown
Created March 20, 2012 05:23
pandora’s vox: on community in cyberspace

pandora’s vox: on community in cyberspace

by humdog (1994)

when i went into cyberspace i went into it thinking that it was a place like any other place and that it would be a human interaction like any other human interaction. i was wrong when i thought that. it was a terrible mistake.

the very first understanding that i had that it was not a place like any place and that the interaction would be different was when people began to talk to me as though i were a man. when they wrote about me in the third person, they would say “he.” it interested me to have people think i was “he” instead of “she” and so at first i did not say anything. i grinned and let them think i was “he.” this went on for a little while and it was fun but after a while i was uncomfortable. finally i said unto them that i, humdog, was a woman and not a man. this surprised them. at that moment i realized that the dissolution of gender-category was something that was happening everywhere, and perhaps it was only just very obvious on the ne

@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html