Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View princefishthrower's full-sized avatar
💭
codevideo.io 🎥

Chris Frewin princefishthrower

💭
codevideo.io 🎥
View GitHub Profile
@princefishthrower
princefishthrower / create_database_commands_simple.txt
Last active April 3, 2020 10:35
Create role, create database, grant privledges on database, connect to database, create table, grant privledges to that table command line
***Issue the following commands in the terminal after logging in with 'psql'
***If you copy paste, note that the new user will be 'new_user' with password 'mysupercoolpassword'
***with database 'new_database' and table 'new_table':
CREATE ROLE new_user WITH LOGIN PASSWORD 'mysupercoolpassword';
CREATE DATABASE new_database;
GRANT ALL PRIVILEGES ON DATABASE new_database TO new_user;
\connect new_database;
CREATE TABLE new_table(id int, some_string varchar, cool_big_int bigint, PRIMARY KEY (id));
GRANT ALL PRIVILEGES ON TABLE new_table TO new_user;
{
"companies": [{
"symbol": "MMM",
"name": "3M Company"
}, {
"symbol": "ABT",
"name": "Abbott Laboratories"
}, {
"symbol": "ABBV",
"name": "AbbVie Inc."
@princefishthrower
princefishthrower / iso_codes.json
Last active August 27, 2018 23:14
Two Letter ISO to Three Letter ISO Country Codes JSON
[
{
"Country": "Afghanistan",
"iso_alpha_2": "AF",
"iso_alpha_3": "AFG",
"iso_un_m49": "004"
},
{
"Country": "Aland Islands",
"iso_alpha_2": "AX",
'use strict';
const http = require('http');
const express = require('express');
const path = require('path');
const app = express();
let server;
app.use('/', express.static('./build'));
FROM ubuntu:16.04
# Ubuntu 16.04 ships with Python 3.5 as default. We should install and use python 3.7 to use the newest Django version (3.0.4 as of March 2020)
# We also need the python3.7-dev package in order for mod_wsgi-standalone to read the headers which are specific to 3.7.7
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt update
RUN apt install -y python3.7
RUN apt install -y python3.7-dev
# Update the simlink of our 'python3' command
@princefishthrower
princefishthrower / partial.js
Last active October 14, 2020 16:16
partial.js - partially evaluate a function
// partial.js - partially evaluate a function
// taken from https://egghead.io/lessons/react-pass-data-to-event-handlers-with-partial-function-application
// usage:
// const addTwo(a, b) => a + b;
// const partialAddTwo = partial(addTwo, 10);
// const sum = partialAddTwo(5);
// console.log(sum);
// 15
export const partial(fn, ...args) => fn.bind(null, ...args);
@princefishthrower
princefishthrower / pipe.js
Last active June 1, 2021 09:36
pipe.js - execute as many functions as needed in series
// pipe.js - execute as many functions as needed in series
// from https://egghead.io/lessons/react-create-a-pipe-function-to-enable-function-composition
// usage:
// const addTwo = (a, b) => console.log(a + b);
// const addThree = (a, b, c) => console.log(a + b + c);
// pipe(addTwo(1, 2), addThree(3, 4, 5));
// 3
// 12
const combine = (f, g) => (...args) => g(f(...args));
export const pipe = (...fns) => fns.reduce(combine);
pipelines:
branches:
master:
- step:
name: Our Very First Pipeline!
script:
- echo "Hello World!"
pipelines:
branches:
master:
- step:
name: Our Very First Pipeline!
script:
- echo "Hello World!"
pipelines:
branches:
master:
- step:
name: Install npm modules with npm install and build production site via tsc
script:
- npm install
- npm run build