Skip to content

Instantly share code, notes, and snippets.


Chad McElligott chadxz

View GitHub Profile
View git-prunelocal
# Prune local tracking branches that have been removed upstream.
# Your remote tracking branches can be removed automatically by setting `fetch.prune` to true or running `git fetch -prune`.
# Another command to clean up your remote tracking branches is `git remote prune <remote>`.
# Author: @leshill
# Modifications by: @chadxz
if [[ $# = 1 && $1 == '-n' ]]; then
chadxz / serialPromises.js
Last active Dec 8, 2015
Serial promises
View serialPromises.js
const keyedObj = {
foo: 'fooVal',
bar: 'barVal',
baz: 'bazVal'
function concatAsync(acc, val) {
console.log(`processing '${val}'`);
return new Promise(resolve => {
chadxz / Chrome 46 WebRTC Renegotiation
Last active Dec 16, 2015
Chrome 46 WebRTC Renegotiation Issues
View Chrome 46 WebRTC Renegotiation

Chrome 46 WebRTC Renegotiation Issues

The below SDP is recreated using the following steps:

  • Participant A offers audio+video to Participant B
  • B answers with audio+video
  • Call connected.
  • A renegotiates to remove audio, making it a video-only call from it's side
    • calls getUserMedia with { audio: false, video: true }
    • removes all streams from the peer connection, and adds the stream from getUserMedia
chadxz /
Last active Nov 17, 2015
Registering a push token with respoke-sdk-android
* Sorry if there are some imports or bits missing that are needed
* to make sense of this. I'm copy/pasting from a working example and
* trying to tease out things that are not relevant to push notification
* registration.
import android.content.Context;
import android.content.Intent;
chadxz /
Created May 21, 2015
Keybase verification

Keybase proof

I hereby claim:

  • I am chadxz on github.
  • I am chadxz ( on keybase.
  • I have a public key whose fingerprint is E7CC 2911 9EE3 FD53 BB0D 37A5 2A94 4B00 61AD 9442

To claim this, I am signing this object:

chadxz / app.js
Created Apr 14, 2014
using path to simplify require
View app.js
// js/app.js
define(['utils'], function (utils) {
'use strict';
return {
initialize: function () {
chadxz / protecting static assets in
Last active Jan 4, 2016
protecting static assets in sails.js
View protecting static assets in

With these files in place, and given you had a static file at assets/protected/hello.txt with the words 'hello world' in it, and another file at assets/robots.txt, you could do sails lift and do a GET on http://localhost:1337/robots.txt and have the file returned normally, but do a GET on http://localhost:1337/protected/hello.txt and you would get 'you are not allowed!'.

You can extend this example to do things like HTTP basic authentication, filtering based on origin, etc.

This gist is inspired by this stackoverflow link

chadxz / CustomMergeVars.cs
Created Sep 23, 2013
Using MailChimp.NET MergeVars in ASP.NET WebForms. This is primarily to illustrate the use of the MergeVar class for sending custom merge variables via the subscribe method.
View CustomMergeVars.cs
using MailChimp.Lists;
using System.Runtime.Serialization;
namespace MyNamespace {
public class CustomMergeVars: MergeVar
public string FirstName { get; set; }
You can’t perform that action at this time.