Skip to content

Instantly share code, notes, and snippets.

View sophistifunk's full-sized avatar

Josh McDonald sophistifunk

  • Expantra
  • Brisbane, Australia
View GitHub Profile
let arr = [10, 11, 12, 13];
console.log(arr.length); // 4
arr.foo = "bar";
console.log(arr.length); // 4
console.log(1 in arr); // true
console.log(arr[10] === undefined); // true
console.log(10 in arr); // false
class Alpha {
constructor() {
this.a = "red";
this.#b = "green";
}
identify() {
console.log(this.a, this.#b);
}
}
@sophistifunk
sophistifunk / arrow binding.js
Created June 8, 2017 07:38
arrow binding.js
class A {
__identify() {
return "Class A"
}
idNotBound() {
return this.__identify()
}
idBound = () => {
#! /usr/local/bin/node
"use strict";
var wordsPerLine = 4;
var crypto = require("crypto");
var fs = require("fs");
var words = JSON.parse(fs.readFileSync(__dirname + "/words.json").toString("UTF8")).words;
var count = words.length;
@sophistifunk
sophistifunk / jenkinsfile
Created July 31, 2017 10:04
Tall and wide pipeline for testing scrolling
node {
stage('Alpha') {
sh 'echo doing stuff'
sh 'sleep 10'
}
stage('Bravo') {
sh 'echo doing stuff'
sh 'sleep 10'
}
stage('Charlie') {
class Foo extends Error {
type: string;
constructor(type: string, message: string) {
super(message);
// Clean up the changes made by super()
this.constructor = Foo;
if ((Object as any).setPrototypeOf) {
Example showing structure:
[
{
"name": "Alpha",
"children": [
{
"name": "Homer",
"children": [],
"state": "not_built",
stage ("Alpha") {
echo "From Alpha"
}
stage ("Bravo-stack") {
parallel(
alpha: {
echo 'Bravo-alpha'
},
bravo: {
echo 'Bravo-bravo'
pipeline {
agent any
stages {
stage("Alpha") {
steps {
echo "From Alpha"
}
}
stage('Tall') {
pipeline {
agent any
stages {
stage('T1 Triggers Bug') {
parallel {
// Removing T1-S1 completely does not trigger bug
stage('T1-S1') {
stages {