Skip to content

Instantly share code, notes, and snippets.


Tobsn tobsn

  • San Francisco/Diego, USA; Munich, Germany;
View GitHub Profile
tobsn / gist:cb182cbe03d4cbeabb572c1391ef1ec4
Created March 22, 2019 00:24
osx battery low apple script
View gist:cb182cbe03d4cbeabb572c1391ef1ec4
set Cap to (do shell script "ioreg -w0 -l | grep ExternalChargeCapable")
tell Cap to set {wallPower} to {last word of paragraph 1}
set CurrentVolume to output volume of (get volume settings)
if wallPower = "Yes" then
return 0
set Cap to (do shell script "ioreg -wO -l | grep Capacity")
tell Cap to set {Available, Max} to {last word of paragraph 2, last word of paragraph 1}
set Pct to round (100 * (Max / Available))
tobsn / strip_markdown.php
Created February 12, 2019 13:20
Strips Markdown from Text - PHP port of
View strip_markdown.php
function strip_markdown( $md = '', $options = [] ) {
// char to insert instead of stripped list leaders (default: '')
$options['listUnicodeChar'] = isset( $options['listUnicodeChar'] ) ? $options['listUnicodeChar'] : false;
// strip list leaders (default: true)
$options['stripListLeaders'] = isset( $options['stripListLeaders'] ) ? $options['stripListLeaders'] : true;
// support GitHub-Flavored Markdown (default: true)
$options['gfm'] = isset( $options['gfm'] ) ? $options['gfm'] : true;
tobsn / Tags > Facebook Checkout.html
Created October 24, 2018 23:01
GTM Facebook Pixel Loader
View Tags > Facebook Checkout.html
var FBDATA = {
sku: JSON.parse('{{CHECKOUT SKUS}}'), // cookie variable with array of SKUs (products on checkout page)
ids: {{A - EDIT THIS - FACEBOOK PIXEL ID LIST}}, // Variable with Pixel IDs
host: '{{Page Hostname}}'
for( var k in FBDATA.ids ) {
View gist:0761b9d657fa7757df982c7a62b51fb9
var poptin, poptin_position, jQ224, all_poptins, test, query_string = new Object,
env = "app",
api_link = "",
cdn_server = "",
poptin_il_url = "",
poptin_com_url = "",
html_poptin_x_button = '<button type="button" id="closeXButton" onclick="closePoptinOnXclick(this);" class="close-x-button" style="text-align: right;display:none; margin-top: -2px;-webkit-appearance: none;cursor: pointer;background: 0 0;border: 0;float: right;padding:0pxfont-size: 20px;line-height: 0.5;color: #000;text-shadow: #fff 0px 0px 10px;filter: alpha(opacity=20);text-transform: none;overflow: visible;margin: 0;font-size:53px;line-height: 31px;z-index: 9999;position: relative;">&times;</button>',
html_poptin_skip_button = '<button type="button" id="closeXButton" onclick="closePoptinOnXclick(this);" class="close-x-button" style="text-align: right;display:none; margin-top: -2px;-webkit-appearance: none;padding: 5px;cursor
tobsn / LocalSettings.php
Created March 27, 2018 01:39 — forked from amrav/LocalSettings.php
Slack integration using Redis
View LocalSettings.php
# Slack integration
require_once "$IP/extensions/Slack/Slack.php";
# Slack extension configuration options
$wgSlackWebhookURL = ""
$wgSlackUserName = "batman";
$wgSlackChannel = "#recent-changes";
$wgSlackIconURL = "";
$wgSlackLinkUsers = true;
tobsn / localstorage.polyfillcheck.js
Last active December 12, 2017 21:32
localStorage polyfill with check first
View localstorage.polyfillcheck.js
try {
return true;
} catch(e) {
return false;
tobsn / gist:796fcbea5b3aa0827ae20a62ec277986
Created November 23, 2017 12:12
Set subdomain Allow Origin on Apache and return 200 OK on OPTONS preflight request for ajax use without jsonp
View gist:796fcbea5b3aa0827ae20a62ec277986
SetEnvIf Origin ^(https?://.+\.yourdomain\.com(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
Header always set Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
Header merge Vary "Origin"
RewriteEngine On
tobsn / list.txt
Created November 7, 2017 00:32
US EAST EC2 Whitelist Optimized CIRD
View list.txt
tobsn / xd60v2.json
Created July 11, 2017 23:36
XD60 v2 kbfirmware config json
View xd60v2.json
tobsn /
Created January 5, 2017 10:18 — forked from v0lkan/
The Evolution of a Software Engineer

This gist outlines the change in the depth and breadth of the tasks and responsibilities of a software engineer as she continuously improves herself.

I created this to supplement a discussion in an internal slack group; then I though the rest of the world might benefit from this too.

Contributions are always welcome.

Associate Engineer

  • Knowledge