Skip to content

Instantly share code, notes, and snippets.

View abranhe's full-sized avatar
🐂
Coding Furiously

Abraham abranhe

🐂
Coding Furiously
View GitHub Profile
@abranhe
abranhe / example1.sql
Created July 18, 2020 03:48
Example SQL Relationship
CREATE TABLE books (
id serial,
title varchar(100) NOT NULL,
author varchar(100) NOT NULL,
published_date timestamp NOT NULL,
isbn char(12),
PRIMARY KEY (id),
UNIQUE (isbn)
);
@abranhe
abranhe / Props
Created June 23, 2020 18:35 — forked from mynameispj/Props
Estimated reading time in PHP, by Brian Cray
Total props to Brian Cray: http://briancray.com/posts/estimated-reading-time-web-design/
@abranhe
abranhe / postgres-cheatsheet.md
Created June 13, 2020 05:52 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@abranhe
abranhe / readme.md
Last active June 13, 2020 05:45
Running pgAdmin with Postgres on Docker - Play with docker

Go to Play with docker and login. Once logged in:

Download pgAdmin

docker pull dpage/pgadmin4

Start the pgAdmin server

@abranhe
abranhe / tutorial.fs
Created June 6, 2020 16:41
Learning F#
// F# is Microsofts functional language
// It provides a way to develop predictable
// code that is often way shorter
// Functional languages apply functions
// to data rather then focus on state changes
// like most OO languages
// Functional languages are great when you
// must execute multiple processes at once.
// Because all variables are immutable it
@abranhe
abranhe / Makefile
Last active June 1, 2020 01:13
Example of Makfile for assignment 1
# You can add comments like this
all: gpa
gpa: lab1.o
gcc lab1.o -o gpa
lab1.o: lab1.c
gcc -c lab1.c -o lab1.o
clean:
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@abranhe
abranhe / readme.md
Last active May 18, 2020 17:31
Get domain name regardless of the subdomain

Get domain name

document.domain

or

window.location.hostname.match(/\w*\.\w*$/gi)[0]
@abranhe
abranhe / Dockerfile
Last active May 14, 2020 05:59
Running Swift on Docker
FROM swiftdocker/swift:latest
ADD fibonacci.swift
@abranhe
abranhe / mysql-docker.sh
Created May 12, 2020 06:44 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE