Skip to content

Instantly share code, notes, and snippets.

@aftaug
aftaug / countries.json
Created June 19, 2018 16:40 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@aftaug
aftaug / figure-donut-chart-with-key.html
Created April 6, 2018 01:13 — forked from markcaron/figure-donut-chart-with-key.html
Final Donut Chart as Figure w/ Key
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat:400);
body {
font: 16px/1.4em "Montserrat", Arial, sans-serif;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
@aftaug
aftaug / mssql-find-foreign-key-references.sql
Created March 11, 2018 21:30 — forked from jeffjohnson9046/mssql-find-foreign-key-references.sql
MS SQL Server: for a given table, find all "child" tables that reference it
-- Based on answer from here:
-- https://stackoverflow.com/questions/483193/how-can-i-list-all-foreign-keys-referencing-a-given-table-in-sql-server
SELECT
child.name AS child_table,
fk.constraint_column_id AS fk_part_no,
c.name AS foreign_key_column
FROM
sys.foreign_key_columns AS fk
JOIN
sys.tables child
@aftaug
aftaug / jquery-deferred-promise-example.js
Created March 11, 2018 21:30 — forked from jeffjohnson9046/jquery-deferred-promise-example.js
A quick example of how to use deferred and promise in jquery
// jsfiddle: https://jsfiddle.net/Lkxtryvp/1/
var myAwesomeLoop = function(x) {
// This is the magic sauce right here - you're creating a unit of work that will be done at some
// point in the future. We're not exactly sure when, but the deferred object will notify us when
// it's done (by calling "resolve()" or "reject()" on itself).
var deferred = $.Deferred();
// We'll create a simple loop to concatenate some values together. This simulates where the
// actual, for-real work would be done (e.g. an AJAX request, some sort of long-running calculation, etc)
@aftaug
aftaug / curl.md
Created February 24, 2018 15:21 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@aftaug
aftaug / postgres-json-cheatsheet.md
Created September 12, 2017 22:02 — forked from rmtsrc/postgres-json-cheatsheet.md
Using JSON in Postgres by example

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
@aftaug
aftaug / nginx.conf
Created May 8, 2017 16:01 — forked from ashleydw/nginx.conf
Laravel nginx conf file
server {
listen 80 default_server;
server_name example.com www.example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
root /srv/www/example.com/public;
index index.php index.html;
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby