Skip to content

Instantly share code, notes, and snippets.

View joshwiens's full-sized avatar

Joshua Wiens joshwiens

View GitHub Profile
@chrisallenlane
chrisallenlane / nginx.conf
Last active March 14, 2020 16:57
This is an nginx configuration that does the following: - Implements a RESTful API using CORS between `example.com` and `api.example.com` - Uses SSL - Reverse-proxies SSL traffic from port 443 to a NodeJS application running on port 8000 Adapted from this page, with thanks to the original author: http://enable-cors.org/server_nginx.html
# Configure the reverse-proxy on port 443
server {
# general configs
keepalive_timeout 30;
listen 127.0.0.1:443 ssl;
server_name api.example.com;
# ssl configs
ssl_certificate /path/to/api.crt;
ssl_certificate_key /path/to/api.key;
@RickCogley
RickCogley / gulpfile.js
Created January 15, 2016 02:10
Inlining-css-via-postcss-import-in-gulp-gulpfile.js
/* eslint-env node */
var concat = require('gulp-concat'),
atImport = require('postcss-import'),
/* mqpacker = require('css-mqpacker'), */
cssnano = require('cssnano'),
cssnext = require('postcss-cssnext'),
gulp = require('gulp'),
postcss = require('gulp-postcss'),
sourcemaps = require('gulp-sourcemaps'),
@PatrickJS
PatrickJS / gulpfile.js
Last active November 6, 2019 23:09
How to setup GulpJS, TypeScript, and Typings also see https://github.com/angular/answers-app/pull/27/files
var gulp = require('gulp');
var tsProject = ts.createProject('tsconfig.json');
var ts = require('gulp-typescript');
gulp.task('build', function() {
return tsProject.src()
.pipe(ts(tsProject))
.pipe(gulp.dest('dist'));
});

We're excited to have you attend one of our workshops! Here's a JavaScript (re)fresher to help you get up-to-speed on some features of the language we'll be using.

Let and Const

JavaScript has always had var:

var name = 'Ryan'
@bahmutov
bahmutov / README.md
Last active October 4, 2023 08:35
Single command to run Node with local file access

Goal: run a simple NodeJS application inside a Docker container

Subgoal: give it access to local files.

docker run -it --rm --name example -v "$PWD":/usr/src/app -w /usr/src/app node:5-slim node index.js

output:

@mraible
mraible / mock.search.service.ts
Created March 16, 2016 05:18
Correct Search Service
import {provide} from 'angular2/core';
import {SpyObject} from 'angular2/testing_internal';
import {SearchService} from '../search.service';
export class MockSearchService extends SpyObject {
getAllSpy;
getByIdSpy;
searchSpy;
saveSpy;
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@gerhardberger
gerhardberger / .hyperterm.js
Created July 15, 2016 19:48
tomorrow night eighties colors for hyperterm
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
fontFamily: '"Droid Sans Mono", Menlo, monospace',
// terminal cursor background color (hex)
cursorColor: '#cccccc',
@colophonemes
colophonemes / create_triggers
Last active February 17, 2024 15:15
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
/* this plugin fixes missing asset caching support in extract-text-webpack-plugin, preventing unnecessary rebuilds */
const { CachedSource, ConcatSource } = require('webpack-sources');
const loaderUtils = require('loader-utils');
module.exports = class {
apply(compiler) {
compiler.plugin("compilation", function (compilation) {
compilation.plugin("optimize-assets", function (assets, callback) {
if (!assets) {