Skip to content

Instantly share code, notes, and snippets.

View gaybro8777's full-sized avatar
💭
Im not gay. I'm just getting back at my dad for not getting me an xbox

Michael Corrado gaybro8777

💭
Im not gay. I'm just getting back at my dad for not getting me an xbox
View GitHub Profile
@gaybro8777
gaybro8777 / uglifyjs-benchmark-results.md
Created May 24, 2018 10:39 — forked from FGRibreau/uglifyjs-benchmark-results.md
Real-world benchmark results of UglifyJS v1 vs UglifyJS v2

Compressing 4 bundles with Pound (npm view pound) with JavaScript production code from https://redsmin.com


UglifyJS v1

  • times: 37720ms 36971ms
  • output size: 533Ko, 479Ko, 120Ko, 538Ko
@gaybro8777
gaybro8777 / array.until.js
Created May 24, 2018 10:41 — forked from FGRibreau/array.until.js
Array::until - Return the array elements until a selector is matched #javascript
Object.defineProperty(Array.prototype, 'until',{
/**
* Return the array elements until a selector is matched
* @param {Number|String|Function} selector
* @return {Array} A new array that goes from the first element to `selector`
*
* Usage:
* deepEqual([1,2,3,4,5].until(4), [1, 2, 3, 4])
* deepEqual(['a','b','c','d','e'].until('c'), ['a', 'b', 'c'])
* deepEqual([{t:'a'},{t:'b'},{t:'c'},{t:'d'}].until(function(o){return o.t == 'c';}), [{t:'a'},{t:'b'},{t:'c'}])
@gaybro8777
gaybro8777 / merge.js
Created May 24, 2018 10:42 — forked from FGRibreau/merge.js
Merge as it should be ( == $.extend(true, {}, ...))
function myextend(/* args */){
var o = {}
, args = Array.prototype.slice.call(arguments)
, obj = args.shift()
, src = args.shift();
for (var p in src){
if (src.hasOwnProperty(p)){
if (hasOwn.call(obj,p) && typeof obj[p] === 'object' && obj[p] !== null) {
o[p] = myextend(obj[p],src[p]);
// Basic PostgresToSNSWorker worker
const pg = require ('pg');
const pgConString = process.env.POSTGRESQL_CONNECTIONSTRING;
pg.connect(pgConString, function(err, client) {
if(err) {
console.log(err);
}
client.on('notification', function(msg) {
@gaybro8777
gaybro8777 / existsSync.js
Created May 24, 2018 10:43 — forked from FGRibreau/existsSync.js
existsSync - Check if a file exist in NodeJS
/*
fileExistSync - Check if a file exist in NodeJS
Twitter: @FGRibreau / fgribreau.com
Usage:
var fileExistSync = require('./fileExistSync');
var exist = fileExistSync('/var/folders/zm/jmjb49l172g6g/T/65b199');
Support for Nodev0.6

Compiling Solid With Grunt Sass

Grunt-sass uses libsass to compile your sass. Use includePaths to make solid available as an scss import.

  sass: {
    dist: {
      options: {
        includePaths: 'node_modules/bf-solid/_lib'
 },
@gaybro8777
gaybro8777 / log_deadlocks.sh
Created May 27, 2018 22:40 — forked from colinmollenhour/log_deadlocks.sh
Log Innodb Deadlocks
#!/bin/bash
dir=/root/deadlocks
[ -d $dir ] || mkdir -p $dir
cd $dir || { echo "Could not cd to $dir"; exit 1; }
mysql -be 'show engine innodb status;' \
| sed 's/\\n/\n/g' \
| awk '/TRANSACTIONS/{flag=0}flag;/LATEST DETECTED DEADLOCK/{flag=1}' \
> latest.txt
@gaybro8777
gaybro8777 / optimize_media.sh
Created May 27, 2018 22:40 — forked from colinmollenhour/optimize_media.sh
Optimize PNG and JPEG images - incrementally
#!/bin/bash
#
# Optimize all jpg and png files in the cwd
# Run it again to optimize new files since the last run
#
# Example:
# echo "optimize_media.sh > /tmp/optimize.log" | sudo -u www-data bash -s
#
# Colin Mollenhour 2016
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->