$(document).one('feature-a', '#some-id', function() {
$(document).on('some-event', '#some-ids', handler);
});
//Turn on feature a
$('#a, #b').trigger('feature-a');
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 numpy as np | |
def encode(featureset, label, mapping): | |
encoding = [] | |
for (fname, fval) in featureset.items(): | |
if(fname,fval,label) in mapping: | |
encoding.append((mapping[(fname,fval,label)],1)) | |
return encoding | |
def calculate_empirical_fcount(train_toks, mapping): | |
fcount = np.zeros(len(mapping)) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at |
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
type Re = | |
| Lit of char | |
| Seq of Re * Re | |
| Or of Re * Re | |
| Star of Re | |
let rec match2 (re: Re) (str: char list) k = | |
match re with | |
| Lit(c) -> match str with | |
| [] -> false |
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
#!/usr/bin/python | |
import time | |
# for more info https://www.youtube.com/watch?v=oiV6sbuQUNc | |
def round(): | |
for i in "Inhale 2 3 4 Hold 2 3 4 5 6 7 Exhale 2 3 4 5 6 7 8".split(" "): | |
print i | |
time.sleep(1) |
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
package jregress; | |
import org.hamcrest.BaseMatcher; | |
import org.hamcrest.Description; | |
import org.hamcrest.Matcher; | |
import org.junit.Test; | |
import java.io.File; | |
import java.io.IOException; | |
import java.nio.file.Files; |
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
def has_factor(factor, word): | |
return lambda n: word if n % factor == 0 else '' | |
def has_substring(i, word): | |
return lambda n: word if str(i) in str(n) else '' | |
def concat(rule1, rule2): | |
return lambda n: rule1(n) + rule2(n) | |
def one_of(rule1, rule2): |
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
from math import exp | |
from random import gauss, shuffle | |
interest=.01 | |
vol=.15 | |
T = 1.0/365 | |
def moved(x, _): | |
return x * exp((interest-.5*vol**2)*T + vol*T**.5*gauss(0,1)) | |
St0=400.0 |
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
(defn neighbours [cell] | |
(map (partial mapv + cell) | |
[[-1 -1] [-1 0] [-1 1] | |
[ 0 -1] [ 0 1] | |
[ 1 -1] [ 1 0] [ 1 1]])) | |
(def live? #{[true 3] [true 2] [false 3]}) | |
(defn step [live-cells] | |
(set |
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
ruby -run -e httpd . -p 3000 |
NewerOlder