Skip to content

Instantly share code, notes, and snippets.

View 1Marc's full-sized avatar

Marc Grabanski 1Marc

View GitHub Profile
@1Marc
1Marc / picturefill_wrapper.php
Created February 3, 2014 19:51
Simple Wrapper around Scott Jehl's Picturefill
<?php
function get_src($dir, $filename, $res, $filetype) {
return $dir . $filename . ($res ? '@' . $res : '') . '.' . $filetype;
}
function picturefill($filename, $sizes, $filetype, $alt) {
$imgdir = get_template_directory_uri() . '/img/';
$default = get_src($imgdir, $filename, null, $filetype);
$images = array();
@1Marc
1Marc / gist:11277624
Created April 25, 2014 04:24
Regex keyword filter spec
Keywords here are "SVG" and "CSS3"
The regex should find only words found in the text or in individual keywords in a URL seperated by dashes. It should NOT match any keywords located in shortned URL hashes.
Should match:
"I love this thing about SVG. http://foo.com/article"
"This is awesome http://super-awesome-svg.com"
"I <3 this css3 button thing http://codepen.com/abcdefg"
@1Marc
1Marc / debug_in_context.js
Last active August 29, 2015 14:01
debug a function with an unexpected return value in context
// rename a function in your application
// could be MyApp.someFunction;
var debugging = myFunc;
// override that function
myFunc = function() {
// send the arguments over and call it in context
var result = debugging.apply(this, arguments);
// if we get an unexpected result, then let's open the debugger
if (!result) {

Introduction to Web Development

Schedule for Day 1

Time (CDT) Topic
8:30 Tech Check and Hello
9:00 Your coding toolbox: the Browser and Sublime Text 2/3
9:30 The basics of the web: it’s more than just tubes
10:00 HTML – What is markup, why do we have it, and the DOM
@1Marc
1Marc / display-chat-json.html
Last active August 29, 2015 14:04
Output Chat Log
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chat</title>
<link rel="stylesheet" href="normalize.css">
</head>
<body>
<style>
td {
June 2014 - Total minutes: 74252
Section Total Percent
Advanced JavaScript 24893 33.53
JavaScript the Good Parts 7911 10.65
AngularJS In-Depth 6048 8.15
Build Web Apps with Node.js 5497 7.40
JavaScript and jQuery 3838 5.17
jQuery In-Depth 2905 3.91
CSS3 In-Depth 2779 3.74
<?php
if( ( rcp_is_expired( $user_ID ) || rcp_get_status( $user_ID ) == 'cancelled' ) && rcp_subscription_upgrade_possible( $user_ID ) ) {
echo '<a href="' . esc_url( get_permalink( $rcp_options['registration_page'] ) ) . '" title="' . __( 'Renew your subscription', 'rcp' ) . '" class="rcp_sub_details_renew">' . __( 'Renew your subscription', 'rcp' ) . '</a>';
} elseif( ! rcp_is_active( $user_ID ) && rcp_subscription_upgrade_possible( $user_ID ) ) {
echo '<a href="' . esc_url( get_permalink( $rcp_options['registration_page'] ) ) . '" title="' . __( 'Upgrade your subscription', 'rcp' ) . '" class="rcp_sub_details_renew">' . __( 'Upgrade your subscription', 'rcp' ) . '</a>';
} elseif( rcp_is_active( $user_ID ) && rcp_is_paypal_subscriber() ) {
echo '<a href="https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_manage-paylist" target="_blank" title="' . __( 'Cancel your subscription', 'rcp' ) . '">' . __( 'Cancel your subscription', 'rcp' ) . '</a>';
}
do_action( 'rcp_subscri
@1Marc
1Marc / events.json
Created March 8, 2015 07:44
events
[ { received_at: Sat Feb 21 2015 16:46:44 GMT-0600 (CST),
event_key: '1424553188439e0.6449382344726473',
ip: '95.91.242.56',
country: 'DE',
region: '02',
city: 'Munich',
lat: 48.15,
lon: 11.5833,
org: 'Kabel Deutschland Breitband Services GmbH',
email: 'jasalguero@gmail.com',
@1Marc
1Marc / event.json
Created March 8, 2015 08:55
mongo stats
db.events.find({email:"jasalguero@gmail.com"}, {media_id:1, media_duration:1, percent_viewed:1}).pretty()
{
"_id" : "v20150225_44ba9409-0811-4b55-ac72-b9db56692029.1425632019000",
"percent_viewed" : 0.006943268075083266,
"media_id" : "9wypa2kelr",
"media_duration" : 495.876
}
{
"_id" : "1424814515957e0.35607868363149464.1424814517000",
"percent_viewed" : 0.02628883027208419,
@1Marc
1Marc / import_mailchimp_to_intercom.js
Last active August 29, 2015 14:16
Sync MailChimp Subscription Status with Intercom
var Intercom = require('intercom.io');
var options = {
apiKey: "intercomapikey",
appId: "intercomappid"
};
var intercom = new Intercom(options);
var MailChimpAPI = require('./node_modules/mailchimp-api/mailchimp');