This file contains hidden or 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
$.fn.extend({ | |
/** | |
* jQuery plugin determining if an element contains named data-attributes and that their values are non empty | |
* Usage: | |
* | |
* <button id="myButton" data-country="australia" data-city="sydney" data-some-empty-value=""> | |
* | |
* $('#myButton').hasDataAttrib('country') // true | |
* $('#myButton').hasDataAttrib('data-country') // true |
This file contains hidden or 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
#!/usr/bin/env node | |
const exec = require('child_process').exec | |
, Promise = require('promise'); | |
/** | |
* @param {Array} array of shell commands | |
*/ | |
module.exports = function(array){ |
This file contains hidden or 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
FROM nginx | |
# File Author / Maintainer | |
MAINTAINER Christian Rich | |
# Copy custom configuration file from the current directory | |
COPY nginx.conf /etc/nginx/nginx.conf |
This file contains hidden or 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
import parse from 'csv-parse'; | |
import fs from 'fs'; | |
import sqlite3 from 'sqlite3'; | |
import async from 'async'; | |
import csvHeaders from 'csv-headers'; | |
import path from 'path'; | |
let count = 0; | |
/** |
This file contains hidden or 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
// allows YYYY/M/D and periods instead of slashes | |
// http://stackoverflow.com/questions/24989065/trying-to-validate-yyyy-mm-dd | |
/^\d{4}[\/.]\d{1,2}[\/.]\d{1,2}$/ | |
// YYYY-MM-DD and YYYY-M-D | |
// http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript | |
/^\d{4}\-\d{1,2}\-\d{1,2}$/ | |
// YYYY-MM-DD | |
// https://gist.github.com/arth2o/8471150 |
This file contains hidden or 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
import * as httpInterceptor from 'global-request-logger'; | |
const debug = require('debug')('my:app'); | |
if(process.env.DEBUG){ | |
httpInterceptor.initialize(); | |
httpInterceptor.on('success', (req, res) => { | |
const protocol = (req.port === 443 ? 'https://' : 'http://'); |
This file contains hidden or 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
#!/bin/bash | |
# You may want to remove the `--endpoint-url http://localhost:8000` line for actual AWS deployment | |
aws dynamodb create-table \ | |
--endpoint-url http://localhost:8000 \ | |
--table-name exampleTableName \ | |
--attribute-definitions \ | |
AttributeName=id,AttributeType=S \ | |
AttributeName=status,AttributeType=S \ | |
AttributeName=createdDateTime,AttributeType=S \ | |
--key-schema \ |
This file contains hidden or 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
import { describe, it } from 'mocha'; | |
import chai, { expect } from 'chai'; | |
import chaiAsPromised from 'chai-as-promised'; | |
chai.use(chaiAsPromised); | |
describe('Example', () => { | |
it('should return 404', () => | |
expect(foo()).to.eventually.be.rejected | |
.and.be.an.instanceOf(Error) |
This file contains hidden or 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
import util from 'util'; | |
console.log(util.inspect(myObject, false, null, true /* enable colors */)) |
This file contains hidden or 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
cd ~/dynamodb_local_latest | |
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb | |
aws dynamodb create-table \ | |
--endpoint-url http://localhost:8000 \ | |
--table-name pricing-api-tst-menu-dyn \ | |
--attribute-definitions \ | |
AttributeName=id,AttributeType=S \ | |
AttributeName=storeId,AttributeType=S \ | |
--key-schema \ |
OlderNewer