This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'Symfony/Component/ClassLoader/UniversalClassLoader.php'; | |
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); | |
$loader->registerNamespaces(array( | |
'Symfony' => __DIR__.'/../_libs' | |
)); | |
$loader->register(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type F func(i int) int | |
func (f F) compose(inner F) F { | |
return func(i int) int { return f(inner(i)) } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Closure; | |
class Invokable { | |
private $closure; | |
public function __construct(Closure $closure) { | |
$this->closure = $closure; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [ | |
{ id: 1, subdata: { x: 10, y: 20 } }, | |
{ id: 2, subdata: { x: 20, y: 30 } } | |
]; | |
var tpl = new Ext.XTemplate([ | |
'<tpl for=".">', | |
'<p>ID: {id}</p>', | |
'<tpl for="subdata">', | |
'<div style="margin-left: 10px">', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Set []interface{} | |
func Combinations(s []Set) Set { | |
lens := make([]int, len(s)) | |
length := 1 | |
for i, v := range s { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$map = array( | |
'person.firstname' => 'John', | |
'person.lastname' => 'Doe', | |
'gender' => 'male', | |
'some.arbitrary.structure.key' => 'smthng' | |
); | |
function tree($map) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Position(x:Int, y:Int) { | |
def posibleMove(p:Position) = Position(this.x + p.x, this.y + p.y) | |
def distance(p:Position) = { | |
Math.sqrt( | |
Math.pow(Math.abs(p.x - this.x).toDouble, 2) | |
+ Math.pow(Math.abs(p.y - this.y).toDouble, 2) | |
) | |
} | |
def equal(p: Position) = this.x == p.x && this.y == p.y | |
def oddCase(t: Position) = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"time" | |
"github.com/tatsushid/go-fastping" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir /media/iso | |
sudo mount -o loop path/to/file.iso /media/iso | |
#sudo umount /media/iso |