Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Mock wavebeem

View GitHub Profile
View snap point to line segment.md

Snap Point To Line Segment

Segment bisection cursor snapping

                                              +-------------+
                                              |             |
                                              |             |
                                              |             |
                                              |             |
@wavebeem
wavebeem / test.js
Last active Mar 12, 2021
A quick description
View test.js
function main() {
console.log("hello world");
}
main();
View js.sh
#!/usr/bin/env bash
set -eu
main() {
Object.new |
Object.set name "$(echo Brian Mock | String.new)" |
Object.get name
Array.new |
Array.push 1 |
@wavebeem
wavebeem / 1.js
Created Jun 23, 2017
Which syntax reigns supreme?
View 1.js
r => {
var ElseIf = (
P.seqObj(
keyword("elseif"),
r.Expr.trim(_).as("condition"),
keyword("then"),
r.Block.trim(_).as("block"),
).node("ElseIf")
);
return (
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
checkboxes: Ember.computed(function() {
return Array.from({length: 4}, (x, i) => {
return {
index: i,
checked: i >= 2
};
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
checkboxes: Ember.computed(function() {
return Array.from({length: 4}, (x, i) => Ember.Object.create({checked: i >= 2}));
}),
checkboxesAsJson: Ember.computed('checkboxes.@each.checked', function() {
return JSON.stringify(this.get('checkboxes'), null, 2);
})
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
checkboxes: Ember.computed(function() {
return Array.from({length: 4}, (x, i) => Ember.Object.create({checked: i >= 2}));
}),
checkboxesAsJson: Ember.computed('checkboxes.@each.checked', function() {
return JSON.stringify(this.get('checkboxes'), null, 2);
})
View install.ps1
# cd to directory of dotfiles based on this script.
$scriptDir = Split-Path $SCRIPT:MyInvocation.MyCommand.Path -Parent
$dir = Resolve-Path (Join-Path $scriptDir "..")
cd $dir
function install($path) {
$dir = Split-Path $Path
$filename = (ls $path).Name
if ($dir) {
$prefix = Resolve-Path (Join-Path $HOME ".$dir")
View spin.py
#!/usr/bin/env python
import sys
import time
def uchar(code):
return ('\\U%08x' % code).decode('unicode-escape')
start = 0x1F550
end = 0x1F55B
emoji = map(uchar, range(start, end + 1))