Skip to content

Instantly share code, notes, and snippets.

View jkup's full-sized avatar

Jon Kuperman jkup

View GitHub Profile
@jkup
jkup / return.scala
Created October 13, 2016 07:36
Scala Return
def foo() {
var bar = 42
}
@jkup
jkup / return.js
Created October 13, 2016 07:35
JavaScript Return
function foo() {
var bar = 42;
return bar;
}
@jkup
jkup / function.scala
Created October 13, 2016 07:35
Scala Function
def foo() {
println('bar')
}
@jkup
jkup / function.js
Created October 13, 2016 07:34
JavaScript Function
function foo() {
console.log('bar');
}
@jkup
jkup / copyWithinEx2.js
Created October 13, 2016 07:31
copyWithinEx2
[1, 2, 3, 4, 5, 6, 7, 8].copyWithin(0, 3);
// copies the values from index 3 to the end of the array ( 4, 5, 6, 7, 8 )
// plays them in place on the array starting at 0 ( value 1 )
// returns [4, 5, 6, 7, 8, 6, 7, 8]
@jkup
jkup / copyWithinEx1.js
Created October 13, 2016 07:31
copyWithinEx1
[1, 2, 3, 4, 5, 6, 7, 8].copyWithin(0, 3, 5);
// copies the values from index 3 to 5 ( 4, 5 )
// plays them in place on the array starting at 0 ( value 1 )
// returns [4, 5, 3, 4, 5, 6, 7, 8]
@jkup
jkup / copyWithinBasic.js
Created October 13, 2016 07:29
copyWithin
Array.prototype.copyWithin(target, start, end)
@jkup
jkup / example.js
Last active June 11, 2016 06:31
Sometimes it's wild how different my JavaScript looks from a few years ago
'use strict'
import React from 'react'
import { StyleSheet, css } from 'aphrodite'
class ToDoList extends React.Component {
constructor (props) {
super(props)
this.displayName = 'ToDoList'
@jkup
jkup / index.js
Last active April 20, 2016 22:18
JavaScript try-catch
var a, b, c;
try {
b = 'foo';
a = nonExistent;
c = 'bar';
} catch(e) {}
console.log(a, b, c); // 'foo', undefined, undefined
@jkup
jkup / chdir.js
Created March 28, 2016 00:08
Change Directory
#!/usr/bin/env node
const process = require('process')
process.chdir('/foo')
console.log(process.cwd()) // This logs foo
// but then if I run this my terminal doesn't change