Skip to content

Instantly share code, notes, and snippets.

@BrianRosamilia
BrianRosamilia / MariaDB C# Boilerplate
Last active August 29, 2015 14:01
C#/MariaDB code that lets you easily pick an isolation level and read only flag to maximize throughput of queries that can be read only with dirty reads allowed
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Dapper;
namespace Gist
{
@BrianRosamilia
BrianRosamilia / gist:a7dd905a5dd2517f9c8e
Created September 5, 2014 02:42
Removing Facebook Posts
Array.prototype.slice.call(document.getElementsByClassName('userContentWrapper')).forEach(function(itm) {
if (itm.innerHTML.search(/nfl|football/i) != -1) {
itm.parentNode.removeChild(itm)
}
})
@BrianRosamilia
BrianRosamilia / gist:5441481a1a8758907e80
Last active August 29, 2015 14:25
JS Boilerplate for accessing long property chains
Object.prototype.getChainedProperty = function(str) {
var t = str.split('.');
var value = this;
for(x = 0; x < t.length; x++){
if(value[t[x]] === undefined){
return undefined;
}
value = value[t[x]];
}
//The future is now!
global.compiler = require('htmlbars/dist/cjs/htmlbars-compiler.js');
global.DOMHelper = require('htmlbars/dist/cjs/dom-helper.js');
global.hooks = require('htmlbars/dist/cjs/htmlbars-runtime.js').hooks;
global.render = require('htmlbars/dist/cjs/htmlbars-runtime.js').render;
var templateSpec = compiler.compileSpec('<p>hi {{name}}</p>', {});
var template = compiler.template(templateSpec);
var env = { dom: new DOMHelper(), hooks: hooks, helpers: {} };
@BrianRosamilia
BrianRosamilia / gist:6694a0ff6c6d97643f35
Created January 12, 2016 18:32
Find non-HTTPS login pages using google
http login -https
@BrianRosamilia
BrianRosamilia / gist:4887343e8b5948c3a3df
Last active February 10, 2016 21:12
Run local apps from Chrome
--allow-file-access-from-files --enable-file-cookies --disable-web-security
@BrianRosamilia
BrianRosamilia / gist:d14b2a2c1a620431edf0
Created March 21, 2016 23:26
Measure Process Runtime Powershell
Measure-Command {npm run browserifyScripts}
@BrianRosamilia
BrianRosamilia / gist:25f710ac820eb4a3c413
Created March 23, 2016 01:42
Base Vagrant Ubuntu Desktop
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
::Be sure 27017, 389 are forwarded inside Vagrantfile
::vagrant init williamyeh/ubuntu-trusty64-docker
vagrant up
vagrant ssh -- 'docker run --restart=always -d -p 27017:27017 mongo:3.0'
vagrant ssh -- 'docker run --restart=always -d -p 389:389 -e SLAPD_PASSWORD=mysecretpassword -e SLAPD_DOMAIN=ldap.example.org dinkel/openldap'