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
| let Promise = require('bluebird'); | |
| let fs = Promise.promisifyAll(require('fs')); // adds Async() versions that return promises | |
| let path = require('path'); | |
| let _ = require('lodash'); | |
| /** Returns the number of files in the given directory. */ | |
| let countFiles = async function(dir) { | |
| let files = await fs.readdirAsync(dir); | |
| console.log(files); | |
| let paths = _.map(files, (file) => path.join(dir, file)); |
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
| { | |
| "name": "myCoolPlot", | |
| data: [{x: 1, y:0}, {x: 2, y: 4}] | |
| } |
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 AddTodo = ({ | |
| onAddClick | |
| }) => { | |
| let input; | |
| return ( | |
| <div> | |
| <input ref={node => { | |
| input = node; | |
| }} /> |
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 { domain } from 'config' | |
| export default { | |
| signup: async function (body, cb) { | |
| let response = await fetch(`${domain}:8080/signup`, { | |
| method: `POST`, | |
| headers: { | |
| 'Content-Type': `application/json` | |
| }, | |
| body: JSON.stringify(body) |
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
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import re | |
| import gmail | |
| import yagmail | |
| from hackerutils import get_dotenv |
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
| gather_idx <- match(gather_cols, names(data)) | |
| if (anyNA(gather_idx)) { | |
| missing_cols <- paste(gather_cols[is.na(gather_idx)], collapse = ", ") | |
| stop("Unknown column names: ", missing_cols, call. = 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
| ******************* | |
| import os | |
| file_list1 = [] | |
| file_list2 = [] | |
| for top, dirs, files in os.walk('./'): | |
| for nm in files: | |
| file_list1.append(nm) | |
| for top, dirs, files in os.walk('/Users/<user>/Music/iTunes/iTunes Media/Music/'): | |
| for nm in files: | |
| file_list2.append(nm) |
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
| snippet bp "Expand the shebang and add boilerplate text." b | |
| ############################################################################### | |
| # Purpose: ${1:...} | |
| # Author: ${2:...} | |
| # Dependencies: ${3:...} | |
| # Created: `date +%c` | |
| ############################################################################### | |
| ${0} | |
| endsnippet |
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
| if headerrow .== -99 | |
| for (i, x) in enumerate(rawdat) | |
| if any([contains(x, s) for s in ["ID", "DV"]]) | |
| headerrow = i | |
| break | |
| else | |
| continue | |
| end | |
| end | |
| end |
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
| annotate("text", x = -Inf, y = Inf, label = paste0("PredP =", 0.57), hjust = -0.1, vjust = 2, size = 5) + | |
| annotate("text", x = -Inf, y = Inf, label = paste0("EqCrit =", 1), hjust = -0.1, vjust = 4, size = 5) |