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
// limits value to the range min..max | |
function clamp(val, min, max) { | |
return Math.max(min, Math.min(max, val)) | |
} | |
// Find the closest point to the circle within the rectangle | |
// Assumes axis alignment! ie rect must not be rotated | |
var closestX = clamp(circle.X, rectangle.x, rectangle.x + rectangle.width); | |
var closestY = clamp(circle.Y, rectangle.y, rectangle.y + rectangle.height); |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"workbench.startupEditor": "newUntitledFile", | |
"files.associations": { | |
"*.js6": "javascriptreact" | |
}, | |
"editor.multiCursorModifier": "ctrlCmd", | |
"editor.wordWrap": "on", | |
"editor.minimap.showSlider": "always", | |
"editor.minimap.renderCharacters": 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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "ctrl+d", | |
"command": "editor.action.copyLinesDownAction", | |
"when": "editorTextFocus && !editorReadonly" | |
}, | |
{ | |
"key": "shift+alt+down", | |
"command": "-editor.action.copyLinesDownAction", |
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
{ | |
"files.exclude": { | |
"**/.git": true, | |
"**/.gitkeep": true, | |
"**/yarn.lock": true, | |
"**/.DS_Store": true, | |
"**/node_modules": true | |
} | |
} |
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 spiral(X, Y): | |
x = y = 0 | |
dx = 0 | |
dy = -1 | |
for i in range(max(X, Y)**2): | |
if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2): | |
print (x, y) | |
# DO STUFF... | |
if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y): | |
dx, dy = -dy, dx |
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
(![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]; // "fail" | |
++[[]][+[]]+[+[]]; // 10 |
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
"C:\Users\--USER_NAME_HERE--\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --allow-file-access --allow-file-access-from-files --disable-web-security --allow-running-insecure-content --allow-sandbox-debugging --enable-extension-timeline-api |
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
// http://www.actionscript.org/forums/showpost.php3?s=c68c3e3a7b9bfed76d971fe7658dd3b5&p=915318&postcount=7 | |
function pointOnCounterClockwiseDiscreteSpiral( n:int, dir:String="N" ):Point { | |
var n_rt:Number = Math.sqrt(n); | |
var m:int = Math.floor( Math.sqrt(n_rt) ); | |
var negCheck:int = (dir == "S" || dir == "E" ) ? Math.pow(-1, m + 1) : Math.pow(-1, m); | |
var odd:int = (Math.floor(2 * n_rt) % 2); | |
var part1:Number = (n - m * (m + 1)); | |
var part2:Number = (dir="N" || dir="S") ? Math.ceil( m / 2 ) : Math.floor( m / 2 ); | |
var pnt:Point = new Point(); | |
pnt.x = negCheck * ( part1 * !odd + part2 ); |
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 ctx = canvas.getContext('2d'); | |
var iterations = 15, | |
moveX = 10, | |
amp = 80, | |
startX = 200, startY = 200, | |
i, rad, ny; | |
ctx.beginPath(); | |
ctx.moveTo(startX, startY); |
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"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Comments</string> | |
<key>scope</key> | |
<string>source.ts</string> | |
<key>settings</key> | |
<dict> |
NewerOlder