Skip to content

Instantly share code, notes, and snippets.

View 1Marc's full-sized avatar

Marc Grabanski 1Marc

View GitHub Profile
@1Marc
1Marc / index.html
Created April 19, 2015 20:00
Observable HTML
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.25/rx.all.js"></script>
<script src="script.js"></script>
</head>
@1Marc
1Marc / script.js
Created April 19, 2015 19:57
Observables
// Code goes here
window.onload = function() {
var Observable = Rx.Observable;
var textbox = document.getElementById('textbox');
var keypresses = Observable.fromEvent(textbox, 'keypress');
var results = document.getElementById('results');
var searchButton = document.getElementById('searchButton');
var searchButtonClicks = Observable.fromEvent(searchButton, 'click');
function getWikipediaSearchResults(term) {
@1Marc
1Marc / video_progress.js
Created April 17, 2015 05:24
Video Stats
Methods.video_progress = function(user, events){
var progress = _.groupBy(events, 'media_id');
for (var key in progress){
var v = progress[key]
var last_event = _.reduceRight(v, function(a,b){
return (new Date(a.created_at) > new Date(a.created_at)) ? a : b;
});
var percent = 0.0;
v.forEach(function(ev){
@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');
@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 / 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',
<?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
$blacklisted = array(
'bit.ly',
'job',
'career',
'explodingads',
'botly.info',
'.jp',
'.re',
'cl.ly',
'codecanyon',
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
@1Marc
1Marc / vimeo-raw-file
Created July 27, 2014 01:02
Vimeo Raw File Script
copy('<ul>'
+ '<li><a download href="' + $("#use_your_own_player input:eq(2)").val() + '">Mobile .MP4 file</a> (480×270)</li>'
+ '<li><a download href="' + $("#use_your_own_player input:eq(1)").val() + '">Standard Def .MP4 file</a> (640x360)</li>'
+ '<li><a download href="' + $("#use_your_own_player input:eq(0)").val() + '">High Def .MP4 file</a> (1280x720)</li>'
+ '</ul>')
http://vimeo.com/99210022/download?t=1403810003&v=265672656&s=f423e5f7722fe0702204e25c76fea728