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
:: development environment build script | |
:: by: Philip Smith | |
@echo off | |
color 0b | |
title Developer Environment Configurator | |
echo. | |
cls |
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
:: ----------------------------------------------------------------------------------- | |
:: Get System Information of Multiple Hosts | |
:: ----------------------------------------------------------------------------------- | |
:: | |
:: Scans one or many hosts via wmi queries. | |
:: Currenty supported datasets: | |
:: wmic os get /all | |
:: wmic qfe get /all | |
:: wmic logicaldisk get caption,description,filessystem,size,freespace,compressed | |
:: wmic process list brief |
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
:: ------------------------------------- | |
:: Inject .Net3.5 Remotely | | |
:: ------------------------------------- | |
:: By: Philip Smith | |
:: Requires 'psexec' in PATH. | |
:: Download: https://live.sysinternals.com/ | |
:: User executing script needs access to src | |
:: and in the administrators group on dest. | |
@echo off |
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
// create enumerated types in JavaScript | |
const EnumState; | |
(EnumState => { // ES6 IIFE!? No-ice | |
EnumState[EnumState["new"] = 1] = "new" | |
EnumState[EnumState["active"] = 2] = "active" | |
EnumState[EnumState["inactive"] = 3] = "inactive" | |
EnumState[EnumState["done"] = 4] = "done" | |
EnumState[EnumState["deleted"] = 5] = "deleted" | |
})( EnumState || ( EnumState = {} ) ); |
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
// Express.js | |
const express = require('express') | |
const app = express() | |
const router = express.Router() | |
router.route('/objects').get((req, res, next) => { | |
res.send('GET received for objects') | |
}).post((req, res, next) => { | |
res.send('POST received for objects') |
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
// Module Skeleton | |
const MyModule = (function myModule(export) { | |
let _privateVar = 'oogieboogie' | |
export.myMethod = (i) => { | |
console.log(i); | |
} | |
export.myOtherMethod = (j) => { | |
console.log(j); | |
} |
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
// Nodes & Trees Example | |
class Node { | |
constructor(val) { | |
this._val = val; | |
this._parent = null; | |
this._children = []; | |
} | |
isRoot() { | |
return isValid(this._parent); |
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
// Dependency Injection | |
const assert = require('assert') | |
function getAnimals(fetch, id) { | |
return fetch('http://api.animalfarmgame.com/animals/' + id) | |
.then(response => response.json()) | |
.then(data => data.results[0]) | |
} |
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
// using bind() | |
const partialBind = (fn, ...args) => { | |
return fn.bind(null, ...args); | |
}; | |
// with a closure | |
const partial = (fn, ...args) => { | |
return (...moreArgs) => { | |
return fn(...args, ...moreArgs) | |
}; |
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
const map = fn => array => array.map(fn); | |
const multiply = x => y => x * y; | |
const pluck = key => object => object[key]; | |
const discount = multiply(0.98); | |
const tax = multiply(1.0925); | |
const custReq = request({ | |
headers: { 'X-Custom': 'mykey' } |
NewerOlder