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
| /** | |
| * @lon = longitude of selected point | |
| * @lat = latitude of selected point | |
| */ | |
| SELECT | |
| name, | |
| CAST( | |
| offset + | |
| ST_Length(the_geom) * ST_Line_Locate_Point(the_geom, ST_Point(@lon, @lat)) | |
| ) AS Double) |
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
| branches=( master 2.4 ) | |
| modules=( sapphire cms themes ) | |
| for branch in "${branches[@]}" | |
| do | |
| echo "================" | |
| echo "Updating $branch" | |
| echo "----------------" | |
| echo " * pull" | |
| git pull 1> /dev/null |
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 | |
| $rx = <<<'RX' | |
| / | |
| ( | |
| (\\.) | # Any escaped character | |
| ([^<${]) | # Any character that isn't <, $ or { | |
| (<[^%]) | # < if not followed by % | |
| ($[^A-Za-z_]) | # $ if not followed by A-Z, a-z or _ | |
| ({[^$]) | # { if not followed by $ | |
| ({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _ |
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
| object(ParserRegexp)[30] | |
| public 'parser' => | |
| object(SSTemplateParser)[29] | |
| protected 'includeDebuggingComments' => boolean false | |
| protected 'match_Template_typestack' => | |
| array | |
| 0 => string 'Template' (length=8) | |
| protected 'match_Word_typestack' => | |
| array | |
| 0 => string 'Word' (length=4) |
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 | |
| $timezoneAuckland = new DateTimeZone('Pacific/Auckland'); | |
| $timezoneHelsinki = new DateTimeZone('Europe/Helsinki'); | |
| $currentTime = new DateTime('now', $timezoneAuckland); | |
| $helsinkiTime = new DateTime('now', $timezoneHelsinki); | |
| printf( | |
| "It is currently %s <br>", | |
| $currentTime->format(DateTime::RSS) | |
| ); |
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
| # -*- coding: utf-8 -*- | |
| #!/usr/bin/env python | |
| """Finds n-order Polyominos | |
| https://en.wikipedia.org/wiki/Polyomino | |
| Hamish Campbell <hn.campbell@gmail.com> | |
| http://polemic.net.nz | |
| License: CC-BY 2012, use it for good, not for evil. | |
| """ |
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
| /** | |
| * Dojo AMD Google Maps Loader Plugin | |
| */ | |
| define([ | |
| "dojo/_base/kernel", | |
| "dojo/topic" | |
| ], function(kernel, topic) { | |
| var w = kernel.global; | |
| w._googleApiLoadCallback = function() { |
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
| console.log(require('crypto').createHash('sha1').update('blob 14\0Hello, World!').digest('hex')); | |
| $> d4fcfe4d339d4e59d168fdf3c0ad445fa980a7d6 |
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
| # -*- coding: utf-8 -*- | |
| #!/usr/bin/env python | |
| import sys | |
| class Polyomino(object): | |
| def __init__(self, iterable): | |
| self.squares = tuple(sorted(iterable)) | |
| def __repr__(self): |
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
| import sys, itertools | |
| class Polyomino(tuple): | |
| def __hash__(_):return(getattr(_,'',''))or[setattr(_,'',setattr(_,'_',map(min,zip( | |
| *(setattr(_,'p',_.__class__((c[1],m-c[0]-1)for(c)in(_.p))if'p'in(_.__dict__)else(_)) | |
| or(getattr(_,'p'))))))or(min(getattr(_,'',hash(tuple(sorted(setattr(_,'p',_.__class__( | |
| [(x-_._[0],y-_._[1])for(x,y)in(_.p)])if(_._[0]or(_._[1]))else(_.p))or(_.p))))), | |
| hash(tuple(sorted(_.p))))))for(m)in(itertools.repeat(max(max(_,key=max)),4))]and(getattr(_,'')) | |
| def __eq__(*_):return(1&len(set(map(hash,_)))) | |
| def __call__(_,__):return[_.__class__(((__,__),))]if(not(1%__))else(set(itertools.chain(*[set([_.__class__ | |
| (_+tuple([a]))for(a)in(set((c[0]+x,c[1]+y)for(c,(x,y))in(itertools.product( |
OlderNewer