This file contains hidden or 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
function setDiff($a, $b, $out=[]) | |
{ | |
if ($a == [] || $b == []) { | |
foreach ($a as $v) { | |
$out[] = $v; | |
} | |
return $out; | |
} | |
$headA = $a[0]; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>permuteChildren()</title> | |
<script type="text/javascript"> | |
function isElementType(node) { | |
return document.getElementById(node).nodeType == 1; | |
} |
This file contains hidden or 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
<<!DOCTYPE html> | |
<html> | |
<head> | |
<title>rectangles.html</title> | |
<script type="text/javascript"> | |
var nRectangles = 10, | |
containerWidth = 600, | |
containerHeight = 600, |
This file contains hidden or 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 | |
function setDiff($a, $b, $out=[]) | |
{ | |
if ($a == [] || $b == []) { | |
foreach ($a as $v) { | |
$out[] = $v; | |
} | |
return $out; | |
} |
This file contains hidden or 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 | |
function tail(array $a) | |
{ | |
$out = []; | |
unset($a[0]); | |
foreach ($a as $v) { | |
$out[] = $v; | |
} | |
return $out; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>permuteChildren()</title> | |
<script type="text/javascript"> | |
// receives the id of the parent | |
function permuteChildren(nodeId) { | |
// Check if node is of the type 'Element' |
This file contains hidden or 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
class Foo: | |
def __call__(self): | |
print 'you called me' | |
caller = Foo() | |
caller() |
This file contains hidden or 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 | |
$zipFile = $argv[1]; | |
$newName = $argv[2]; | |
if (!($zipFile && $newName)) { | |
die('You need to specify a zip file to rename and a new filename'); | |
} | |
$ext = pathinfo($zipFile, PATHINFO_EXTENSION); |
This file contains hidden or 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
SELECT foo, length(foo) l | |
FROM someTable | |
ORDER BY order by l, foo; |