Skip to content

Instantly share code, notes, and snippets.

View dommmel's full-sized avatar
💭
That worked!

Dominik dommmel

💭
That worked!
View GitHub Profile
@dommmel
dommmel / tracking_url.js
Last active August 29, 2015 14:23
Unbounce Cross Domain External Tracking
// On external pages (same domain) you need to grab the cookie
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
var url = "http://t.unbounce.com/trk?v=" + getCookie('ubvt') + "&g=convert"
// On the unbounce page itself you have direct access
var url = "http://t.unbounce.com/trk?v=" + ub.page.visitorId + "&g=convert"
@dommmel
dommmel / Coce.gs
Created August 2, 2015 13:28
Google Apps Script to upload and import a CSV File into a Google Spreadsheet
// http://stackoverflow.com/questions/11273268/script-import-local-csv-in-google-spreadsheet
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Upload CSV file", functionName: "doGet"}];
ss.addMenu("CSV", csvMenuEntries);
}
function doGet(e) {
var app = UiApp.createApplication().setTitle("Upload CSV to Sheet");
@dommmel
dommmel / README.md
Last active August 29, 2015 14:28
Jekyll YouTube Plugin.

Takes a Youtube URL and generates a responsive snippet

Usage

 {% youtube "https://www.youtube.com/watch?v=ho8-vK0L1_8" %}

or using variables/front matter

@dommmel
dommmel / i18n.js
Last active September 17, 2015 08:14
i18n for static-handlebars-brunch via handlebars-helper-i18n
/*
put this file in your app folder and add the following to yout brunch config.coffee
exports.config =
plugins:
staticHandlebars:
includeFile: 'app/translations.js'
# Usage examples:
# {{i18n "key"}}
# {{i18n "key" language="fr"}}
@dommmel
dommmel / invite_to_slack.js
Created May 25, 2016 14:40
Zapier Code to auto invite users to slack
var slackTeam = "YOUR_SLACK_TEAM_NAME ";
var token = 'YOUR_ADMIN_TEST_TOKEN';
// A test token will suffice.
// You can generate one at https://api.slack.com/docs/oauth-test-tokens
// Just make sure that the user issuing the test token is an admin.
var url = 'https://'+ slackTeam + '.slack.com/api/users.admin.invite';
fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
@dommmel
dommmel / hide_payment-gateway_unless_customer_has_tag.rb
Last active December 12, 2017 14:48
Shopify Script to enable payment gateway only for customer with a certain tag
PAYMENT_GATEWAY_NAME = 'Invoice'
CUSTOMER_TAG = 'VIP'
customer = Input.cart.customer
remove_gateway = (customer.nil? or !customer.tags.include?(CUSTOMER_TAG))
if remove_gateway
Output.payment_gateways = Input.payment_gateways.delete_if do |payment_gateway|
payment_gateway.name == PAYMENT_GATEWAY_NAME
end
@dommmel
dommmel / mamp_function
Last active March 24, 2018 20:10 — forked from jonathanstark/mamp_function
Serve the current directory with MAMP from the command line
function mamp() {
#
# Default location of the apache conf file for MAMP
CONF_FILE="/Applications/MAMP/conf/apache/httpd.conf"
#
# Fish existing doc root out of conf file
LINE=$(cat $CONF_FILE | grep "^DocumentRoot")
QUOTED_STRING=${LINE/DocumentRoot /}
OLD_DOC_ROOT=${QUOTED_STRING//\"/}
#
@dommmel
dommmel / blob_authenticatable.rb
Last active July 12, 2023 01:01
Devise authentication for Rails' ActiveStorage
# Rails controller concern to enable Devise authentication for ActiveStorage.
# Put it in +app/controllers/concerns/blob_authenticatable.rb+ and include it when overriding
# +ActiveStorage::BlobsController+ and +ActiveStorage::RepresentationsController+.
#
# Optional configuration:
#
# Set the model that includes devise's database_authenticatable.
# Defaults to Devise.default_scope which defaults to the first
# devise role declared in your routes (usually :user)
#
@dommmel
dommmel / SketchSystems.spec
Last active October 14, 2018 20:26
Image Modifier
Image Modifier
Specify Preview Image*
Empty URL*
typed -> Filled URL
Filled URL
submitted -> Select Ad Format
Select Ad Format
selected Single -> Single
selected Carousel -> Carousel
Carousel*
#!/usr/bin/env bash
# Enter your license key below
license_key=XXXXXXXXXXXXXXXXX
curl -O -J -L 'https://sendy.co/download/?license=${license_key}'
filename=$(basename -- sendy-*.zip)
newdir="${filename%.*}"
echo ${newdir}