Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
find . -type f -name "*.html.twig" | xargs perl -pi -e "s/>([^\s<{>].*?)</>{{ '\1'|trans }}</g" |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
I know a lot of people have trouble zooming and panning d3. Indeed, I found myself in a situation where I had a simple bar chart to which I wanted to add the zoom behavior, and also make the full chart draggable. I saw several extremely complex examples of d3 charts with zooming and panning, and thought that there must be an easier way, particularly if you don't need to scale the x and y axes. There is, and here is is in CoffeeScript:
vis.call(d3.behavior.zoom()
.on("zoom", ->
g.attr("transform", "translate(" + d3.event.translate[0] + "," + d3.event.translate[1] + ") scale(" + d3.event.scale + ")")
)
)
<?php | |
function set() { | |
return new Set(func_get_args()); | |
} | |
class Set implements Countable, Iterator { | |
private $data = array(); | |
function __construct($data) { |
<?php | |
namespace CoreDomain\Car; | |
class Car | |
{ | |
private $id; | |
private $make; | |
private $model; | |
private $registrationNumber; |
<?php | |
// iterator impl: | |
class MapIterator extends IteratorIterator { | |
private $f; | |
public function __construct($f, $inner) { | |
parent::__construct($inner); | |
$this->f = $f; |
module InventoryItems(Command(..), Event(..), handle) where | |
import Data.Maybe(isJust) | |
type Id = String | |
type Name = String | |
type Amount = Int | |
data Command = CreateInventoryItem Id | |
| RenameInventoryItem Id Name |
<?php | |
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} |
<?php | |
mb_internal_encoding("UTF-8"); | |
function λ($fn) { | |
list($args, $body) = explode('=>', $fn, 2); | |
$args = trim($args); | |
$args = ltrim($args, '('); | |
$args = rtrim($args, ')'); |
// TState is an individual, immutable state entry in the projection state | |
// Flavor 1: | |
Projection<TState>. | |
When<TEvent>.ThenAdd<TKey, TEvent>(Func<TEvent, TKey> selector, Func<TEvent, TState> handler). | |
When<TEvent>.ThenUpdate<TKey, TEvent>(Func<TEvent, TKey> selector, Func<TState, TEvent, TState> handler). | |
When<TEvent>.ThenAddOrUpdate<TKey, TEvent>(Func<TEvent, TKey> selector, Func<TEvent, TState> addHandler, Func<TState, TEvent, TState> updateHandler) | |
When<TEvent>.ThenRemove<TKey, TEvent>(Func<TEvent, TKey> selector) | |
// TState is an individual, immutable state entry in the projection state | |
// Flavor 2: Add & Update melted into Set leaving the host to deal with Add or Update semantics |