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_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
@PaulKinlan
PaulKinlan / canvasrecord.js
Last active August 9, 2022 11:55
Screen recorder in JS
(function() {
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
var options = {mimeType: 'video/webm; codecs=vp9'};
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
@dpogue
dpogue / xcode8.js
Last active March 21, 2018 15:38
Hook for Cordova iOS to support "developmentTeam" in buildConfig.json
"use strict";
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var encoding = 'utf-8';
var filepath = 'platforms/ios/cordova/build.xcconfig';
if (context.opts.cordova.platforms.indexOf('ios') === -1) return;
@mbijon
mbijon / lock-plugins.php
Created August 26, 2016 02:17 — forked from daggerhart/lock-plugins.php
Simple plugin that prevents requests for updats for a given list of plugins.
<?php
/*
* Plugin Name: Lock plugin updates
* Description: Prevent plugin updates
* Version: 1.0.0
* Author: daggerhart
*/
add_filter( 'http_request_args', 'lock_plugins_http_request_args', 5, 2 );
@daggerhart
daggerhart / lock-plugins.php
Created August 25, 2016 21:05
Simple plugin that prevents requests for updats for a given list of plugins.
<?php
/*
* Plugin Name: Lock plugin updates
* Description: Prevent plugin updates
* Version: 1.0.0
* Author: daggerhart
*/
add_filter( 'http_request_args', 'lock_plugins_http_request_args', 5, 2 );
@smowden
smowden / after_prepare.es5.js
Last active December 31, 2016 14:04
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();
# coding: utf-8
# Imports
import os
import cPickle
import numpy as np
import theano
import theano.tensor as T
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@wesbos
wesbos / gist:0d5572a29e4f5688a1c8
Last active September 1, 2023 17:59
Handy list of widths to target in a responsive website
320
321
322
323
324
325
326
327
328
329