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
Template.name.rendered = -> | |
# resize the text areas | |
Meteor.defer -> | |
$('.content').on( 'change keyup keydown paste cut', 'textarea', | |
-> $(this).height(0).height(this.scrollHeight)).find('textarea').change() | |
$('textarea').trigger('change') |
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
crypto = require "crypto" | |
key = "this is my password. Make it as long as you want. But its hashed into 512 bytes." | |
text = "This is the text. as long as you want it" | |
hash = (utf8String)-> | |
hasher = crypto.createHash('sha512') | |
hasher.update(utf8String, 'utf8') | |
hexString = hasher.digest('hex') | |
return hexString |
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
# An example of how to make decorators and also how *args and **kwargs work. | |
from functools import partial | |
def wrapping(func): | |
def wrapper(func, *args, **kwargs): | |
# print "wrapper" | |
# print func | |
# print args | |
# printwrappergs |
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
import theano | |
import theano.tensor as T | |
import numpy | |
# The model basically looks like this: | |
# | |
# o_t a_t | |
# | | | |
# | | |
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
match = (obj, properties) -> | |
for k,v of properties | |
if not k of obj | |
return false | |
else if v instanceof Object | |
if not match obj[k], v | |
return false | |
else if obj[k] isnt v | |
return false | |
return true |
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
var a = {} | |
var b = new ReactiveVar(1); | |
var c = new ReactiveVar(2); | |
var needsUpdate = new Tracker.Dependency() | |
Tracker.autorun(function(){ | |
a.b = b.get() | |
needsUpdate.changed() | |
}) |
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
export function makePayment(loanId, amount, paymentMethodId) { | |
return dispatch => { | |
dispatch(makePaymentSent()) | |
fetch(`/api/loans/${loanId}/payments`, { | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
}), | |
credentials: 'same-origin', | |
method: 'POST', | |
body: JSON.stringify({ |
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
export function makePayment(loanId, amount, paymentMethodId) { | |
return dispatch => { | |
dispatch(makePaymentSent()) | |
fetch(`/api/loans/${loanId}/payments`, { | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
}), | |
credentials: 'same-origin', | |
method: 'POST', | |
body: JSON.stringify({ |
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
// api.js | |
export function makePayment(loanId, amount, paymentMethodId) { | |
return fetch(`/api/loans/${loanId}/payments`, { | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
}), | |
credentials: 'same-origin', | |
method: 'POST', | |
body: JSON.stringify({ | |
'amount': amount, |
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
// api.js | |
export function makePayment(loanId, amount, paymentMethodId) { | |
return fetch(`/api/loans/${loanId}/payments`, { | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
}), | |
credentials: 'same-origin', | |
method: 'POST', | |
body: JSON.stringify({ | |
'amount': amount, |