Skip to content

Instantly share code, notes, and snippets.

let myArr = [1, 2, 3];
console.log(myArr);
// [1, 2, 3]
myArr.push(4);
console.log(myArr);
// [1, 2, 3, 4]
let myArr = [1, 2, 3];
console.log(...myArr);
// 1 2 3
let arrOne = [1, 2, 3];
let arrTwo = [...arrOne, 4];
console.log(arrOne, arrTwo);
// [1, 2, 3] [1, 2, 3, 4]
let arrThree = [-1, 0, ...arrTwo];
console.log(arrThree);
// [-1, 0, 1, 2, 3, 4]
let objOne = {name: 'buck', height: 6};
objOne.name = 'avery'; // object mutated
// non-mutation with assign method
// don't forget the empty object as the first parameter
let objTwo = Object.assign({}, objOne, {height: 4});
console.log(objOne, objTwo);
// {name: "avery", height: 6} {name: "avery", height: 4}
let objOne = {name: 'avery', height: 6};
let objTwo = {...objOne, height: 4};
console.log(objOne, objTwo);
// {name: "avery", height: 6} {name: "avery", height: 4}
// ARROW GENERATOR
@mixin arrow(
$box-edge: top,
$arrow-size: 10px,
$border-width: 4px,
$background-color: white,
$border-color: black) {
position: relative;
background: $background-color;
<!doctype html>
<html>
<head>
<script src="https://rawgit.com/aframevr/aframe/b813db0614ac2b518e547105e810b5b6eccfe1c8/dist/aframe.min.js"></script>
</head>
<body>
<script>
AFRAME.registerComponent('set-sky', {
schema: {default: ''},
init() {
@captDaylight
captDaylight / botStarter.js
Last active October 1, 2016 20:29
Script to get you started making your
if (!process.env.token) {
process.exit(1);
}
const Botkit = require('botkit');
const controller = Botkit.slackbot({
debug: true,
});
hears(['play'], 'direct_message,direct_mention,mention', (bot, message) => {
const { user, channel, text } = message; // destructure message variable
const userData = text.match(/<@([A-Z0–9]{9})>/); // parse the text for user's 9 character id
if (userData) {
// if there is a user challenged, start the game
} else {
bot.reply(message, 'You didn\'t challenge anyone…');
}
});
...
if (userData) {
const playerTwo = userData[1]; // player two's id is at the first index of match results
const gameData = {
id: channel,
players: {
[user]: {
accepted: true,
played: '',
},