This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
| alias ..="cd .." | |
| alias ...="cd ../.." | |
| alias ll="ls -lah" | |
| alias cls="clear" | |
| # docker aliases | |
| alias dps="docker ps -a" | |
| alias dstop="docker stop" | |
| alias dstart="docker start" | |
| alias dpull='docker pull' |
OlderNewer