Skip to content

Instantly share code, notes, and snippets.

Brian Dombrowski bdombro

Block or report user

Report or block bdombro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View firebase-file-upload.js
handleValidSubmit = async (event: any, values: {title: string; description: string; file: any}) => {
const {currentUser} = this.props.mobx;
if (this.state.loading) {
console.log("Submit ignored because loading.");
return;
}
this.setState({loading: true});
try {
@bdombro
bdombro / mysql-drop-all-tables.sql
Created Sep 10, 2018
mysql-drop-all-tables.sql
View mysql-drop-all-tables.sql
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables
FROM information_schema.tables
WHERE table_schema = 'database_name'; -- specify DB name here.
SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
View git-change-origin-url.sh
cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.com:bdombro/test.git
git push -u origin --all
git push -u origin --tags
View srdb.cli.php
#!/usr/bin/php -q
<?php
// CUSTOM: Increase memory limit to improve likelyhood of success
ini_set('memory_limit','500M');
/**
* To run this script, execute something like this:
* `./srdb.cli.php -h localhost -u root -n test -s "findMe" -r "replaceMe"`
* use the --dry-run flag to do a dry run without searching/replacing.
@bdombro
bdombro / gist:f45dc7e16f2ed821d2c5d271302c38ce
Created May 24, 2018
Timeout - Run process and kill if it runs too long.
View gist:f45dc7e16f2ed821d2c5d271302c38ce
#!/bin/bash
# Src: http://www.ict.griffith.edu.au/anthony/software/timeout.sh
#
# timeout [-SIG] [time] [--] command args...
#
# Run the given command until completion, but kill it if it runs too long.
# Specifically designed to exit immediatally (no sleep interval) and clean up
# nicely without messages or leaving any extra processes when finished.
#
@bdombro
bdombro / nginx-pm2-reverse-proxy-with-caching.conf
Last active Jul 20, 2018
NGINX PM2 Reverse Proxy with Caching
View nginx-pm2-reverse-proxy-with-caching.conf
# Note: if using cloudfare, you MUST add a http redirect rule in cloudflare or
# cf will cache the 301 redirect for both HTTP AND HTTPS, causing an infinite 301 loop
# Ex rule: http://*domain.dev/* with action Always Use HTTPS
# Ref: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
proxy_cache_path /var/cache/nginx/aii.globalintegrity.org_proxy levels=1:2 keys_zone=aii.globalintegrity.org_proxy:10m max_size=187108864 inactive=7d use_temp_path=off;
server {
listen 80;
View CommonBinaryExtensions.txt
*.3ds
*.3g2
*.3gp
*.7z
*.a
*.aac
*.adp
*.ai
*.aif
*.aiff
@bdombro
bdombro / .gitlfstracks
Last active Dec 20, 2018
Git LFS Default Tracks - Common binary file extensions
View .gitlfstracks
"To include this, run `cat .gitlfstrack | xargs git lfs track`"
"*.3ds"
"*.3g2"
"*.3gp"
"*.7z"
"*.a"
"*.aac"
"*.adp"
"*.ai"
"*.aif"
View wp-cli-installer.sh
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
@bdombro
bdombro / youtube-play-when-visible.js
Created Mar 16, 2018
youtube-play-when-visible.js
View youtube-play-when-visible.js
/*
This code will autostart a youtube when visible and stop when not. You could alternatively purchase plugin ARVE pro.
Caveits:
- Only currently works with one video right now
- Depends on jQuery
Usage: Add this anywhere
<div class="youtube-smartstart-iframe" data-youtube-id="vfuLDmGbqTI"></div>
You can’t perform that action at this time.