Skip to content

Instantly share code, notes, and snippets.

Brandon Smith BrandonSmith

Block or report user

Report or block BrandonSmith

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
@BrandonSmith
BrandonSmith / apns.sh
Created Jun 22, 2018
fcm-apns-debugging
View apns.sh
#!/bin/bash
curl=/usr/local/opt/curl/bin/curl
openssl=/usr/local/opt/openssl/bin/openssl
deviceToken=TOKEN
authKey="./AuthKey_##########.p8"
authKeyId=##########
teamId=##########
@BrandonSmith
BrandonSmith / index.js
Last active Sep 1, 2017
Reply sometimes does not work
View index.js
const {app,Notification} = require('electron')
app.on('ready', () => {
showNextNotification()
})
let i = 0
showNextNotification = () => {
const notification = new Notification({
@BrandonSmith
BrandonSmith / main.js
Created Aug 4, 2017
Electron `call` interface between main and renderer processes
View main.js
import { ipcMain } from 'electron'
import uuid from 'uuid'
/**
* Makes a data request over IPC to renderer process
* @param {string} request Request type known to main handler
* @param {object} Optional `options` object used as parameters for request
* @return {Promise} Promise of data
*/
export function call(window, request, options={}) {
@BrandonSmith
BrandonSmith / main.js
Created Aug 4, 2017
Electron `call` interface between main and renderer processes
View main.js
import { ipcMain } from 'electron'
import uuid from 'uuid'
/**
* Makes a data request over IPC to renderer process
* @param {string} request Request type known to main handler
* @param {object} Optional `options` object used as parameters for request
* @return {Promise} Promise of data
*/
export function call(window, request, options={}) {
@BrandonSmith
BrandonSmith / electron-lets-move.js
Created Jun 6, 2017
Fork of `electron-lets-move`
View electron-lets-move.js
import {
app,
dialog,
shell
} from 'electron'
import os from 'os'
import childProcess from 'child_process'
import sudo from 'sudo-prompt'
import path from 'path'
View sms_blaster.sh
#!/bin/bash
if [ $# -lt 5 ]; then
echo -e "./send_sms.sh <device> <to_number> <big|small> <number_of_texts> [sleep_time]"
exit 0
fi
if [ $5 -ge 500 ]; then
while true; do
read -p "Are you sure you want to send >500 texts? y/n`echo $'\n> '`" yn
@BrandonSmith
BrandonSmith / conf.js
Created Aug 10, 2015
Google Form Filler
View conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: ['example-spec.js'],
jasmineNodeOpts: {
View RoundedBitmapDrawableUsage.java
Bitmap batmapBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.batman);
RoundedBitmapDrawable circularBitmapDrawable = //
RoundedBitmapDrawableFactory.create(getResources(), batmapBitmap);
circularBitmapDrawable.setCornerRadius(batmapBitmap.getWidth());
myImageView.setImageDrawable(circularBitmapDrawable);
System.out.prinln("MyActivity", "That's all folks");
@BrandonSmith
BrandonSmith / keybase.md
Created Sep 22, 2014
Keybase Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am brandonsmith on github.
  • I am brandonsmith (https://keybase.io/brandonsmith) on keybase.
  • I have a public key whose fingerprint is 42F0 33EE 3293 9438 48DD 74EF 8BE9 B7D4 6824 BE70

To claim this, I am signing this object:

View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
You can’t perform that action at this time.