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 arrsize=100000 | |
// time cost for array constructing | |
var i = 0 | |
var ar = [] // literal notation | |
var arr = new Array(arrsize) // new length defined | |
i = 0 | |
console.time("Literal notation with assigning directly") | |
while(i<arrsize){ |
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 * as _ from 'lodash'; | |
// Mock out lodash debounce implementation, so it calls the debounced method immediately | |
jest.spyOn(_, 'debounce').mockImplementation( | |
jest.fn((fn: any) => { | |
// fn.cancel = jest.fn(); | |
// fn.flush = jest.fn(); | |
return fn as (((...args: any[]) => any) & _.Cancelable); | |
})); |
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 controlP5.*; | |
ControlP5 controlP5; | |
void setup() { | |
// .... | |
new EndlessKnob(controlP5, "knob1").setRange(0,360) | |
.setPosition(70, 120) |
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
# Add parent directory to path, to allow script's access to modules | |
abs_path = os.path.abspath(os.path.dirname(__file__)) | |
parent_dir = os.path.join(abs_path, os.path.pardir) | |
sys.path.insert(0, parent_dir) |
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
param($url, $filename) | |
$webclient = New-Object System.Net.WebClient | |
$filepath = "$pwd\$filename" | |
$webclient.DownloadFile($url,$filepath) | |
echo "Saved $filename" |
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
" Cmd command to run external commands asynchronously (Windows) | |
" e.g. :Cmd python -m unittests discover | |
command -nargs=+ Cmd :!start cmd /c <q-args> & pause |
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
@python c:\Python27\lib\pydoc.py %* |
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
" initially i was using 3-space (shiftwidth=3) indentation with noexpandtab, and tabstop=8, the default | |
" this switches it to proper 4-space indentation with expandtab | |
" convert tabs to spaces | |
set tabstop=8 | |
set shiftwidth=3 | |
set expandtab | |
retab | |
" convert spaces to tabs |