Skip to content

Instantly share code, notes, and snippets.

View eckdanny's full-sized avatar
🏠
Working from home

Danny eckdanny

🏠
Working from home
View GitHub Profile
@eckdanny
eckdanny / on-class-type-generics-and-duck-typing-in-typecsript.md
Created November 7, 2017 21:50
on Class Type Generics and Duck Typing in TypeScript

A coworker shared a TypeScript snippet. Here's my thoughts.

The Post

Here's the [paraphrased] message:


Something I thought I'd post here... one of the most useful custom types I've seen and used:

type ClassName<T> = { new (...args: Array<any>): T }
@eckdanny
eckdanny / sayIntro.js
Created October 26, 2017 08:43
SoftSkills
const operands = [
[ 'Third Normal Form Databases' ],
[ 'exception handling' ],
[ 'computer science degree', 'a' ],
[ 'Capability Maturity Model', 'a' ],
[ 'GitHub profile', 'a' ],
[ 'variadic pure functions' ],
[ 'requirements analysis' ],
[ 'abstract base classes'],
[ 'row-level locking' ],
diff --git a/Gruntfile.js b/Gruntfile.js
index dc80c05..7228c67 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,7 +10,10 @@
module.exports = function (grunt) {
// Load grunt tasks automatically
- require('load-grunt-tasks')(grunt);
+ require('jit-grunt')(grunt, {
@eckdanny
eckdanny / gist:7b2be5f885b7e4f1a887
Created June 24, 2014 13:53
Dijkstra's Shortest Path for Weighted Directed Graphs
// http://coderbyte.com/CodingArea/GuestEditor.php?ct=Weighted%20Path&lan=JavaScript
var input = ['4','A','B','C','D', 'A|B|2', 'C|B|11', 'C|D|3', 'B|D|2'];
var output = 'A-B-D';
console.log(output === (function (strArr) { 'use strict';
// Process input data
var count = strArr.shift()
, nodes = strArr.splice(0, count)
@eckdanny
eckdanny / Duh.js
Created June 5, 2014 22:24
Forehead slapper after code challenge
'use strict';
var input = [
'[[({}{})]{}]',
'][(}))(}})]',
'[(){}]',
']()',
'{([]{})()}'
]
, output = [1, 0, 1, 0, 1 ]
@eckdanny
eckdanny / gist:11293413
Created April 25, 2014 15:24
HoDA Chars
Abomination
Ancient Darkspawn
Ancient Rock Wraith
Anders
Apostate Wanderer
Arcane Horror
Arlathan General
Armored Bear
Armored Ogre
Ashaad
@eckdanny
eckdanny / gist:8573601
Last active January 4, 2016 05:09
SublimeText build system: console.log() search
{
// ...
"build_systems":
[
{
"cmd": "echo 'Found console.log() statement(s):'; grep -rEnio 'console.log\\(.+\\).*\\$' --exclude-dir=app/bower_components app | awk -F: '{printf \" - %-30s%-7s%-s\\n\", \\$1, \\$2, \\$3}'; echo",
"name": "Find console.log()",
"shell": true,
...
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
> gifsicle@0.1.4 postinstall /home/deck0/foo/node_modules/grunt-contrib-imagemin/node_modules/gifsicle
> node lib/check.js
gifsicle: downloading [===================] 100% 0.0s
✗ pre-build test failed, compiling from source...
@eckdanny
eckdanny / bobstrap
Created August 29, 2013 02:52
to install, just paste into your ~/.bashrc file. Then open a new terminal (or source ~/.bashrc), create a directory, and run with `bobstrap` and you'll be all setup!
bobstrap() {
# CONFIG
GIT_USERNAME='thebobg'
GIT_REPONAME='bobStrap'
GIT_BRANCH='master'
# Stop Editing Below Here
curl -L -s -o /tmp/"$GIT_REPONAME".tar.gz https://api.github.com/repos/"$GIT_USERNAME"/"$GIT_REPONAME"/tarball/"$GIT_BRANCH"
tar -xf /tmp/"$GIT_REPONAME".tar.gz --strip 1 --exclude '*\.md' -C $(pwd) && rm /tmp/"$GIT_REPONAME".tar.gz
}