Skip to content

Instantly share code, notes, and snippets.

View kdimatteo's full-sized avatar

Keith DiMatteo kdimatteo

View GitHub Profile
@kdimatteo
kdimatteo / write-version-file.ts
Created September 6, 2018 18:09
Write a version-file
import * as rootRequire from 'root-require';
import * as cp from 'child_process';
import * as fs from 'fs';
const packageLockJSON = rootRequire('./package-lock.json');
const packageJSON = rootRequire('./package.json');
const versionFile = 'dist/assets/version.json';
const orgPrefix = '@mhe'
const output = {
1
00:00:02,123 --> 00:00:04,123
This is the first subtitle
2
00:00:05,000 --> 00:00:08,000
Another subtitle demonstrating tags:
<b>bold</b>, <i>italic</i>, <u>underlined</u>
<font color="#ff0000">red text</font>
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
@kdimatteo
kdimatteo / components.hello-component.js
Created August 23, 2016 14:02 — forked from danlourenco/components.hello-component.js
component interpolation within handlebars template
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['ember-component']
});
function numToWords (num) {
var a = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];
var b = ['', '', 'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety'];
if ((num = num.toString()).length > 9) {
return 'num overflow';
}
var n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
if (!n) return;
var str = '';
@kdimatteo
kdimatteo / gist:bf17920d95a6452f33b8
Created November 9, 2015 19:24
Count Angular Watchers
// taken from http://ng.malsup.com/#!/counting-watchers
(function countAngularWatchers(angular) {
var i, data, scope,
count = 0,
all = document.all,
len = all.length,
test = {};
var mostWatchers = 0;
@kdimatteo
kdimatteo / gist:7db7d06e9b46dfbfa110
Created September 17, 2015 18:30
T-Account example
<table border="0" cellpadding="0" cellspacing="0" class="ez-t-account">
<thead>
<th colspan="2">A T-Account</th>
</thead>
<tbody>
<tr>
<td>$300<br>$1,200</td>
<td>$1,500</td>
</tr>
</tbody>
@kdimatteo
kdimatteo / gist:0909cd415459869cce03
Last active August 29, 2015 14:27
RHEL CI Provision
yum install -y jenkins
yum install -y git
yum install -y nodejs
yum install -y npm
echo "Fix Node JS naming issue with a symlink"
ln -s /usr/bin/nodejs /usr/bin/node
#download jenkins CLI
wget http://localhost:6060/jnlpJars/jenkins-cli.jar
@kdimatteo
kdimatteo / gist:fc2cb3d7726de60ff8f3
Created January 23, 2015 21:41
Convert {{#each foo in foos}} to {{#each foos as |foo|}} with this one weird Vim/sed trick:
:s/#each\s\v\zs(<\w*>)\sin\s(<(\w|.)*)>/\2 as |\1|/
@kdimatteo
kdimatteo / gist:2bc0aa0906c326770b0d
Last active August 29, 2015 14:10
ember-cli http-mock proxy
// file: /server/proxies/products.js
// instead of a mock, i always want to hit the API for this endpoint...
module.exports = function(app) {
var url = require('url');
var proxy = require('proxy-middleware');
app.post("/api/products/*", proxy(url.parse('http://foo.bar.com/api/products')));
};