Skip to content

Instantly share code, notes, and snippets.

View mbijon's full-sized avatar
🎯
Focusing

Mike Bijon mbijon

🎯
Focusing
View GitHub Profile
var scripts = ['app.a700a9a3e91a84de5dc0.js']; // script for all users
var newBrowser = (
'fetch' in window &&
'Promise' in window &&
'assign' in Object &&
'keys' in Object
);
if (!newBrowser) {
@mbijon
mbijon / juggernaut.rb
Created December 22, 2016 23:49 — forked from maccman/juggernaut.rb
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@mbijon
mbijon / juggernaut_channels.rb
Created December 22, 2016 23:49 — forked from maccman/juggernaut_channels.rb
Sinatra Server Side Event streaming with private channels.
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@mbijon
mbijon / canvasrecord.js
Created November 6, 2016 21:36 — forked from PaulKinlan/canvasrecord.js
Screen recorder in JS
(function() {
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
@mbijon
mbijon / move_to_rds.rb
Created October 10, 2016 01:35 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
#!/usr/bin/env ruby
require 'rubygems'
require 'friendly'
Friendly.configure(
:adapter => 'mysql',
:host => 'localhost',
:user => 'root',
:password => '',
#!/usr/bin/env ruby
require 'rubygems'
require 'friendly'
Friendly.configure(
:adapter => 'mysql',
:host => 'localhost',
:user => 'root',
:password => '',
@mbijon
mbijon / disable-xss-auditor.sh
Created September 19, 2016 19:04
CLI command to start Chrome with XSS Auditor disabled. Use for XSS/security testing
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --disable-xss-auditor --enable-devtools-experiments --disable-features=enable-automatic-password-saving
@mbijon
mbijon / after_prepare.es5.js
Created September 7, 2016 17:36 — forked from smowden/after_prepare.es5.js
ES5 version for adding intent filters via cordova hooks on android
'use strict';
module.exports = function (context) {
var fs = require('fs');
var _ = require('lodash');
var scheme = 'flowkey';
var insertIntent = '\n <intent-filter>\n <action android:name="android.intent.action.VIEW"></action>\n <category android:name="android.intent.category.DEFAULT"></category>\n <category android:name="android.intent.category.BROWSABLE"></category>\n <data android:scheme="' + scheme + '"></data>\n </intent-filter>\n ';
var manifestPath = context.opts.projectRoot + '/platforms/android/AndroidManifest.xml';
var androidManifest = fs.readFileSync(manifestPath).toString();
@mbijon
mbijon / bin(slash)rails_addition.rb
Created September 5, 2016 19:38
Output load order of Rails boot/init/config files Add following code to bin/rails & run `rails s` w/ logging. Not 100% complete, but fills-in blanks in http://guides.rubyonrails.org/initialization.html --from: http://stackoverflow.com/q/8672803/982920
files = []
tp = TracePoint.new(:line) do |tp|
if tp.path =~ /bole_api/
unless files.include? tp.path
puts "#{tp.path}".inspect
files.push(tp.path)
end
end
end
tp.enable