Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / ajaxListener.js
Last active March 8, 2018 19:02 — forked from icodejs/ajaxListener.js
JS: Listen to ajax calls from Javascript
// https://stackoverflow.com/a/6036392/383904
var open = window.XMLHttpRequest.prototype.open,
send = window.XMLHttpRequest.prototype.send,
onReadyStateChange;
function openReplacement(method, url, async, user, password) {
var syncMode = async !== false ? 'async' : 'sync';
console.warn(
'Preparing ' +
syncMode +
@bmcculley
bmcculley / .Xresources
Created March 21, 2018 18:12 — forked from vreon/.Xresources
molokai color theme for xterm
! Molokai theme
*xterm*background: #101010
*xterm*foreground: #d0d0d0
*xterm*cursorColor: #d0d0d0
*xterm*color0: #101010
*xterm*color1: #960050
*xterm*color2: #66aa11
*xterm*color3: #c47f2c
*xterm*color4: #30309b
*xterm*color5: #7e40a5
@bmcculley
bmcculley / README.md
Created April 27, 2018 05:42 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@bmcculley
bmcculley / how-to-copy-aws-rds-to-local.md
Last active May 22, 2019 11:35 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@bmcculley
bmcculley / webserver.go
Created January 9, 2023 20:42 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010 Alexis ROBERT <alexis.robert@gmail.com>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import (
"compress/gzip"
@bmcculley
bmcculley / HelloYaml.java
Last active June 27, 2024 13:04 — forked from ericlee996/HelloYaml.java
Simple SnakeYAML example
import org.yaml.snakeyaml.Yaml;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.File;
import java.util.Map;
public class HelloYaml {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws FileNotFoundException {