Skip to content

Instantly share code, notes, and snippets.

@mdkarp
mdkarp / passUTM.js
Created August 28, 2019 23:07 — forked from dillansimmons/passUTM.js
Pass current UTMS to in page links Javascript
// JS for grabbing utm params and parsing into url
var getRefQueryParam = function() {
var temp = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function() {
var decode = function(s) {
return decodeURIComponent(s.split("+").join(" "));
};
temp[decode(arguments[1])] = decode(arguments[2]);
});
return temp;
@mdkarp
mdkarp / Using Github Deploy Key.md
Created September 25, 2018 16:57 — forked from zhujunsan/Using Github Deploy Key.md
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@mdkarp
mdkarp / 0_reuse_code.js
Created July 27, 2016 15:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mdkarp
mdkarp / .gitignore
Last active August 29, 2015 14:06 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
@mdkarp
mdkarp / gist:4015387
Created November 5, 2012 04:46 — forked from zhendershot/gist:3607211
REST API Upload to S3 in Titanium
function upload(name, file, callback) {
Ti.include('lib/sha-aws.js'); // file comes from this URL's project: http://aws.amazon.com/code/Amazon-S3/3236824658053653
Ti.include('lib/webtoolkit.utf8.js'); // code for this file from this URL: http://www.webtoolkit.info/javascript-utf8.html
Ti.include('lib/date.js'); // file comes from this URL: http://www.mattkruse.com/javascript/date/source.html
var AWSAccessKeyID = appGlobal.config.s3AccessKey;
var AWSSecretAccessKey = appGlobal.config.s3SecretKey;
var AWSBucketName = appGlobal.config.s3BucketName;
var AWSHost = appGlobal.config.s3Host;