Skip to content

Instantly share code, notes, and snippets.

Cristobal Dabed cristobal

View GitHub Profile
View duration_re.js
const pattern =
new RegExp(
// starts with PT
'^PT' +
// one or more digits followed by the hours designator H
'((\\d+)H){0,1}' +
// one or more digits followed by the minutes designator M
'((\\d+)M){0,1}' +
// one or more digits with precission followed by the seconds designator S
'((\\d+(\\.\\d+){0,1})S){0,1}' +
View duration.js
function parseDesignators (duration) {
return [
{
name: 'hours',
designator: 'H'
},
{
name: 'minutes',
designator: 'M'
},
View location.conf
location /gdpr/mobile/webview {
# proxy_pass https://static.nrksuper.no;
# proxy_pass http://localhost:80;
proxy_cache CACHE;
proxy_cache_valid 200 10m;
proxy_cache_revalidate on;
# proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
@cristobal
cristobal / index.html
Last active Jun 8, 2017
Ludo Mediasync Test Example
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://static.nrk.no/core-fonts/latest/core-fonts.min.css">
<link rel="stylesheet" href="https://static.nrk.no/core-css/latest/core-css.min.css">
<title>Ludo Timing Example</title>
<style>
h3 {
padding: 10px 0 0 10px;
@cristobal
cristobal / AbstractError.js
Last active Dec 14, 2016
AbstractError + CustomError
View AbstractError.js
// @see https://github.com/bjyoungblood/es6-error
// @see http://dailyjs.com/2014/01/30/exception-error/
import {map} from 'lodash';
const defineProperty = (obj, prop, value) => {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
value
});
@cristobal
cristobal / reduce-promises-over-x.js
Created Sep 1, 2016
Reduce a set of promises (S) over a a value x
View reduce-promises-over-x.js
const reducePromises = (S, x) =>
S.reduce((f, g) => f.then(g), Promise.resolve(x));
View keybase.md

Keybase proof

I hereby claim:

  • I am cristobal on github.
  • I am cristobal (https://keybase.io/cristobal) on keybase.
  • I have a public key ASAs5cvXRdcF-ajmMlIOsVqdbEkEVN0SUSEyZUPhWZ0OAgo

To claim this, I am signing this object:

@cristobal
cristobal / # mosml - 2016-03-19_16-50-37.txt
Created Mar 19, 2016
mosml on OS X 10.11.3 - Homebrew build logs
View # mosml - 2016-03-19_16-50-37.txt
Homebrew build logs for mosml on OS X 10.11.3
Build date: 2016-03-19 16:50:37
@cristobal
cristobal / machine-diskutil.sh
Last active Feb 12, 2019
Machine Diskutil to mount/unmont external volumes inside docker machines running on Virtualbox
View machine-diskutil.sh
#!/usr/bin/env sh
# @see http://stackoverflow.com/questions/30040708/how-to-mount-local-volumes-in-docker-machine
# @see https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md
################################################################################
# Dependency Section #
# #
################################################################################
check_deps() {
## Make sure commands are available
@cristobal
cristobal / propel_session_config.php
Created Apr 20, 2015
Silex - Propel + Session in DB
View propel_session_config.php
<?php
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Propel\Runtime\Propel;
use Propel\Runtime\Connection\ConnectionWrapper;
use Propel\Runtime\Connection\PdoConnection;
use Propel\Silex\PropelServiceProvider;
//--------------------------------------
You can’t perform that action at this time.