Skip to content

Instantly share code, notes, and snippets.

Avatar

Gavin Vickery geekforbrains

View GitHub Profile
@geekforbrains
geekforbrains / nginx_reverse_proxy.conf
Last active Nov 5, 2020
Nginx reverse proxy for Heroku
View nginx_reverse_proxy.conf
upstream heroku {
server myapp.herokuapp.com;
}
server {
server_name ~^(www\.)(?<domain>.+)$;
return 301 $scheme://$domain$request_uri;
}
server {
@geekforbrains
geekforbrains / rollback.sh
Created Dec 20, 2016
How to properly rollback a commit in Git
View rollback.sh
git revert --no-commit <sha>..HEAD
git commit
@geekforbrains
geekforbrains / shell.sh
Created Nov 15, 2016
Installing psycopg2 in virtualenv on macOS Sierra
View shell.sh
$ xcode-select --install
$ brew install openssl
$ virtualenv env
$ . env/bin/activate
$(env) env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
@geekforbrains
geekforbrains / multiple_responses.json
Created Sep 8, 2016
Watson Converstation API - Multiple Responses
View multiple_responses.json
{
"output": {
"text": {
"values": [
"My name is Alexander.",
"You can call me Alexander",
"Friends call me Alex"
],
"selection_policy": "random",
"append": false
@geekforbrains
geekforbrains / django_disco.sh
Last active Mar 10, 2016
A simple tool for clearing and rebuilding database and migrations in Django during dev
View django_disco.sh
#!/usr/bin/env bash
echo "Database name:"
read db_name
# Delete migration folders
find apps -iname 'migrations*' -exec rm -rf {} \; > /dev/null 2>&1
# Re-create empty migration folder with __init__ file
for d in apps/*; do
View validate.js
function validateForm() {
var fields = [
'date_Inspection Date',
'txt_Serial Number',
// Add more fields here
];
for(var i = 0; i < fields.length; i++) {
var field = fields[i];
var value = this.getField(field).value.trim();
if(value == '') {
View source.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>3, 2, 1 - Go!</title>
<style>
#countdown {
position: absolute;
left: 50%;
top: 50%;
View countdown.css
#countdown {
position: absolute;
left: 50%;
top: 50%;
width: 100px;
height: 100px;
display: none;
margin: -50px 0 0 -50px;
border: 2px solid #cecece;
background-color: #fefefe;
@geekforbrains
geekforbrains / nsscreencast_curl.sh
Created Sep 25, 2015
cURL request to NSScreencast login
View nsscreencast_curl.sh
curl -v https://www.nsscreencast.com/login
* Trying 162.243.42.159...
* Connected to www.nsscreencast.com (162.243.42.159) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
* Server certificate: www.nsscreencast.com
* Server certificate: COMODO RSA Domain Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
* Server certificate: AddTrust External CA Root
> GET /login HTTP/1.1
> Host: www.nsscreencast.com
@geekforbrains
geekforbrains / get_simulator_documents_path.swift
Last active May 30, 2018
Print the full path to your iOS simulators documents directory
View get_simulator_documents_path.swift
#if arch(i386) || arch(x86_64)
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString
NSLog("Document Path: %@", documentsPath)
#endif