Skip to content

Instantly share code, notes, and snippets.

View davidDuymelinck's full-sized avatar

davidDuymelinck

View GitHub Profile
@small: ~"(max-width: 300px)";
@medium: ~"(max-width: 500px)";
// from responsive.less
@font-size-base: 16px;
.font-size(@size) {
@remValue: (unit(@size) / unit(@font-size-base));
@pxValue: unit(@size);
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
<?php
class MixedGallery extends WireData implements Module {
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them
*
* @return array
*
*/
Newsletter.prototype.send = function send(){
var self = this,
mailCount = 0,
mailMax = this.people.length;
// people, from, subject, text and html are set before sending the mails
_.forEach(this.people, function(to){
var mail = {
from: this.from,
to: to,
@davidDuymelinck
davidDuymelinck / 404.html
Last active August 29, 2015 14:09
Step by step creation of a node site
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Error 404</title>
</head>
<body>
<h1>Page not found</h1>
<p><a href="/">Home</a></p>
</body>

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@davidDuymelinck
davidDuymelinck / package.json
Last active August 29, 2015 14:11
ES6 head first
{
"name": "livevalidation-es6",
"version": "0.0.0",
"description": "es6 version of livevalidation",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/6to5 src -d test/out && node_modules/.bin/6to5 test-es6 -d test && mocha"
},
"author": "",
"license": "ISC",
@davidDuymelinck
davidDuymelinck / index.html
Last active August 29, 2015 14:14
web component static website demo
<html>
<head>
<link rel="import" href="indexMain.html">
</head>
<body>
<section class="main"></section>
<script src="site.js"></script>
<script>
site.addTemplate('.main', 'indexMain.html');
</script>
@davidDuymelinck
davidDuymelinck / ContactController.php
Last active September 26, 2015 10:45
Laravel 5 contact demo
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Requests\ContactFormRequest;
use App\Events\ContactFormValid;
class ContactController extends Controller {
public function getIndex()
.quanty-query(@number, @comparison, @content) when (@comparison = 'greater'), (@comparison = 'more'), (@comparison = '>'){
&:nth-last-child(n @{number}):first-child {
&,
& ~ * {
@content();
}
}
}
.quanty-query(@number, @comparison, @content) when (@comparison = 'fewer'), (@comparison = 'less'), (@comparison = '<'){
&:nth-last-child(-n @{number}):first-child {
@davidDuymelinck
davidDuymelinck / index.php
Created March 27, 2015 05:45
quick and dirty php routing
<?php
$path = isset($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI'];
if(strpos($path, '/search/book') !== false){ echo str_replace('/search/book/', '', $path); }