Skip to content

Instantly share code, notes, and snippets.

View nathanbrauer's full-sized avatar

Nathan J. Brauer nathanbrauer

View GitHub Profile
/**
* A function which takes your e-junkie cl number and deletes all cart cookies related to your account
*/
function deleteCartCookies(cl) {
var cookies = document.cookie.split(";");
var cl = Number(cl);
var cookie, eqPos, name;
for (var i = 0; i < cookies.length; i++) {
{
"0-mail.com": {},
"027168.com": {},
"0815.su": {},
"0sg.net": {},
"10mail.org": {},
"10minutemail.co.za": {},
"11mail.com": {},
"123.com": {},
"123box.net": {},
@nathanbrauer
nathanbrauer / auto-append-gdpr-field-in-marketo.html
Created May 23, 2018 20:18
For addition to Google Tag Manager; expected trigger: All Pages.
<script type="text/plain" id="gdpr-acknowledgement">
<div class="mktoFormRow gdpr-acknowledgement-row" style="margin-bottom:1em;">
<div class="mktoFormCol" style="margin-bottom: 10px;">
<div class="mktoFieldWrap mktoRequiredField" style="display: flex !important;">
<div class="mktoLogicalField mktoCheckboxList mktoHasWidth mktoRequired mktoInvalid"
style="position: relative;">
<div class="mktoAsterix" style="position: absolute; right: 0;">*</div>
<input name="PSEUDO_GDPR_Opt_In__c" id="PSEUDO_GDPR_Opt_In__c" type="checkbox" value="yes" class="mktoField">
<label for="PSEUDO_GDPR_Opt_In__c"></label>
</div>
@nathanbrauer
nathanbrauer / gitpullalllocal.sh
Last active May 26, 2017 16:01 — forked from Tanapruk/gitpullalllocal.sh
Looping through all local git branch and git pull them each
#if there is a passing argument
if [ -z $1 ]
then
GIT_RELATIVE_DIRECTORY="$(pwd)"
else
GIT_RELATIVE_DIRECTORY=$1
fi
#go to that relative path if exists
cd ${GIT_RELATIVE_DIRECTORY}
@nathanbrauer
nathanbrauer / .htaccess
Created May 1, 2017 18:19
Block robots on all domains except those whitelisted
# START: BLOCKING ROBOTS ON ALL ENVIRONMENTS EXCEPT LIVE-PROD
# If domain is NOT (www|uk|au|fr|de).marketo.com...
RewriteCond %{HTTP_HOST} !^(www|uk|au|fr|de)\.marketo\.com$
# ...then set environment variable BLOCK_ROBOTS to 1
RewriteRule .* - [E=BLOCK_ROBOTS:1]
# Now, if BLOCK_ROBOTS is present then set robots header
Header set X-Robots-Tag "noindex, nofollow" env=BLOCK_ROBOTS
# END: BLOCKING ROBOTS ON ALL ENVIRONMENTS EXCEPT LIVE-PROD
<Files *.*>
# Force all files to download
Header set Content-Disposition attachment
</Files>
@nathanbrauer
nathanbrauer / export-passwords-from-google-passwords.js
Last active November 25, 2018 21:40
Export your passwords from https://passwords.google.com into JSON format that you can use to import into other password managers
var clicks = document.querySelectorAll('.Vaa'),
passwords = {},
wait = false,
idx = 0,
gloival;
gloival = setInterval(function(){
var el, pw, row, pival;
if (!wait) {
wait = true;
@nathanbrauer
nathanbrauer / sync-projects
Last active February 4, 2020 21:14 — forked from JonasGroeger/sync-projects
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
if [[ `whoami` == "root" ]]; then
echo "DO NOT run this program as root! Quitting."
exit 1
fi
<?php
if (!function_exists('http_response_code')) {
function http_response_code($code = null)
{
static $defaultCode = 200;
if (null != $code) {
switch ($code) {
case 100: $text = 'Continue'; break; // RFC2616
@nathanbrauer
nathanbrauer / non-static.php
Last active May 18, 2022 03:03
Ways to alias a method on a class.
<?php
/**
* Ways to alias a method on a class.
*
* Methods are in order of least preferred (top) to most preferred (bottom). Code style, not performance, is taken into account.
*/
Class Program {
const SECONDS = 1;
const MICROSECONDS = 2;