Skip to content

Instantly share code, notes, and snippets.

@dreadjr
dreadjr / Appfile.rb
Created May 31, 2017 22:41 — forked from ravishtiwari/Appfile.rb
Ionic Build IPA with Fastlane tool
app_identifier "com.yourorganization.mytodoapp" # The bundle identifier of your app
apple_id "<You Apple Id>" # Your Apple email address
# You can uncomment any of the lines below and add your own
# team selection in case you're in multiple teams
# team_name "CAMobileApp"
# team_id "Q2CBPJ58CA"
# you can even provide different app identifiers, Apple IDs and team names per lane:
# https://github.com/KrauseFx/fastlane/blob/master/docs/Appfile.md
@dreadjr
dreadjr / timestamp_version_bump.js
Created April 28, 2017 20:03
Apache Cordova build hook to auto bump iOS CFBundleVersion and Android versionCode
#!/usr/bin/env node
var fs = require("fs"),
path = require("path");
var rootdir = process.argv[2];
if (rootdir) {
module.exports = function(context) {
@dreadjr
dreadjr / Stop Permssion Errors on Firebase & AngularFire Logout - README.md Prevent permission denied errors from Firebase on logout (caused by active $firebaseArray & $firebaseObject connections not being destroyed). Example code follows John Papa's style guide.
// change group currency task registration
export let changeGroupCurrency = functions
.database
.ref('/serverTasks/currencyChange/{taskId}')
.onWrite(event => changeGroupCurrency(event));
// function which changes group's currency and updates exchange rates of all expenses
async function changeGroupCurrency(event: Event<DeltaSnapshot>)
{
// prevent triggering this function after writing response code
@dreadjr
dreadjr / twitter_update_with_media.coffee
Created March 10, 2017 21:40
Node.js module for basic Twitter update_with_media support. You will need to install 'request' packages from npm like so: npm install request
fs = require('fs')
path = require('path')
request = require('request')
class twitter_update_with_media
constructor: (@auth_settings) ->
@api_url = 'https://api.twitter.com/1.1/statuses/update_with_media.json'
post: (status, file_path, callback) ->
r = request.post(@api_url, oauth:@auth_settings, callback)
@dreadjr
dreadjr / index.md
Created February 24, 2017 02:27 — forked from alexcasalboni/index.md
Bridge Function between Kinesis Streams and Step Functions

Bridge Function between Kinesis Streams and Step Functions

For each record read from the Kinesis Stream, a StepFunction state machine will be executed asynchronously.

Required Environment Variables

  • region: the AWS region where your StepFunction state machine is defined.
  • stateMachineArn: the ARN of the StepFunction state machine you want to execute.

Notes

@dreadjr
dreadjr / dynFib.js
Created February 7, 2017 19:38 — forked from mlhaufe/dynFib.js
Dynamic Programming with Fibonacci
//More info: <https://thenewobjective.com/blog/2013/01/dynamic-programming-for-great-justice/>
// Imperative: O(n) time, O(1) space
function fib(n){
if(n < 2)
return n;
var f0 = 0, f1 = 1, f;
for(var i = 1; i < n; i++){
@dreadjr
dreadjr / wget on osx sierra
Last active February 7, 2017 05:38 — forked from burakerdem/gist:d8195e6e343aa55ff578
Installing wget on Mac OS X El Capitan 10.11
curl -O http://ftp.gnu.org/gnu/wget/wget-1.17.tar.gz
tar -xzf wget-1.17.tar.gz
cd wget-1.17
ln -s /usr/local/opt/openssl /usr/local/ssl
./configure --with-ssl=openssl
./configure --with-ssl=openssl --with-libssl-prefix=/usr/local/ssl
make
sudo make install
wget --help
cd .. && rm -rf wget*
@dreadjr
dreadjr / pr.md
Created January 3, 2017 18:44 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dreadjr
dreadjr / install-git-completion.sh
Created December 9, 2016 19:42 — forked from johngibb/install-git-completion.sh
Mac OS X - Install Git Completion
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi