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 re | |
import sys | |
from subprocess import Popen, PIPE | |
from multiprocessing import Pool | |
PDS_BASE = 'http://aws-publicdatasets.s3.amazonaws.com/' | |
WARC_PATHS = { | |
'2014-12': 'common-crawl/crawl-data/CC-MAIN-2014-52/warc.paths.gz', | |
'2015-07': 'common-crawl/crawl-data/CC-MAIN-2015-32/warc.paths.gz' |
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 co from 'co'; | |
app.post("/purchase", (req, res) => { | |
co(function* () { | |
const person = yield user.findOneAsync(req.body); | |
const permissions = yield permissions.findAllAsync(person); | |
if (isAllowed(permissions)) { | |
const confirmNum = yield transaction.processAsync(user); | |
res.send("Your transaction was successful!") | |
} | |
}).catch(err => handleError(err)) |
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 React from 'react'; | |
import { reduxForm, Field } from 'redux-form'; | |
import { ScrollView, Text, TouchableOpacity } from 'react-native'; | |
import moment from 'moment'; | |
import MyTextInput from './MyTextInput'; | |
/** | |
* Automatically adds the dashes required by the specified phone format and limits the input to ten 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
export default reduxForm({ | |
form: 'signIn', | |
asyncValidate: (values) => { | |
return new Promise((resolve, reject) => { | |
// simulate request | |
setTimeout(() => { | |
if (values.email.indexOf('@gmail.com') === -1) { | |
reject({ email: 'Only mails at gmail are allowed' }); | |
} else { | |
resolve(); |
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
<!DOCTYPE html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
// The event listener for the file upload | |
document.getElementById('txtFileUpload').addEventListener('change', upload, 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
// Examples: | |
JavaScript.load("/javascripts/something.js"); | |
JavaScript.load("http://www.someawesomedomain.com/api.js", function() { | |
API.use(); // or whatever api.js provides ... | |
}); | |
/** Tested with: |
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
{"error": 42716.2954, "samples": 506, "value": [22.532806324110698], "label": "RM <= 6.94", "type": "split", "children": [{"error": 17317.3210, "samples": 430, "value": [19.93372093023257], "label": "LSTAT <= 14.40", "type": "split", "children": [{"error": 6632.2175, "samples": 255, "value": [23.349803921568636], "label": "DIS <= 1.38", "type": "split", "children": [{"error": 390.7280, "samples": 5, "value": [45.58], "label": "CRIM <= 10.59", "type": "split", "children": [{"error": 0.0000, "samples": 4, "value": [50.0], "label": "Leaf - 4", "type": "leaf"}, {"error": 0.0000, "samples": 1, "value": [27.9], "label": "Leaf - 5", "type": "leaf"}]}, {"error": 3721.1632, "samples": 250, "value": [22.90520000000001], "label": "RM <= 6.54", "type": "split", "children": [{"error": 1636.0675, "samples": 195, "value": [21.629743589743576], "label": "LSTAT <= 7.57", "type": "split", "children": [{"error": 129.6307, "samples": 43, "value": [23.969767441860473], "label": "TAX <= 222.50", "type": "split", "children": [{"err |
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
const pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]); | |
const hashKey = 'react-snapshot-hash'; | |
const crcTable = []; | |
const initialCrc = 0xffffffff; | |
for (let n = 0; n < 256; n++) { | |
let c = n; | |
for (let k = 0; k < 8; k++) { | |
if (c & 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
function drawMouseSpeedDemo() { | |
var mrefreshinterval = 500; // update display every 500ms | |
var lastmousex=-1; | |
var lastmousey=-1; | |
var lastmousetime; | |
var mousetravel = 0; | |
var mpoints = []; | |
var mpoints_max = 30; | |
$('html').mousemove(function(e) { | |
var mousex = e.pageX; |
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
# EditorConfig is awesome: https://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true |
OlderNewer