Skip to content

Instantly share code, notes, and snippets.

View gajus's full-sized avatar

Gajus Kuizinas gajus

View GitHub Profile
_="Z=[@c.width=c.heighA2*(H=300 NB49;P=w*=;x=HEi-jF;y=H*3E-k-kF;Style='hsl('+t*20+','+99*!r+'%,'+ 99*pow(u/11/C+'%)';VbeginPath( VmovQ+,y+w---=h*,y-w+ (G;D=74(=||[])[i+D]=[-9,C=IB@DB7;T=J=m=0;m<6e2;){X) YK+=5*G}setInterval(s= W^_0;P#,4*D`9 A(s>0?D:-D q=WJ r=^-I+B/N <0(_s*t*3.2,P(2,2,3,9.9`CB0EK<025*RF(R)EA*2Es>0Fs*(2-sF(1-t (z= A_0]>0 z,1 z<0? (1.4+ *25+/6,9-z/3,5):(_z)? 6,3): 3,6 ;u=t+2@L=t){k+=u-1; 1,4` k;$Gk>15$ i||j|| 0.3,5G},99 onkeydown=D+=4O3 W9O7 ^(==40O8 p=Z[X=Y=@17(AI,I=-J,J=t 32p.push(1 66L1+L];67(2]?p.pop():K--G{p=Z[@w.keyCodeMath. VlinQfunction(w,h,t,u,r){;^-D;j<=D;j)W-D;i<=D;i)(Y-i*I-j*JUH/#) P(1, ); floor(i**j)5(==3(X+i*J-j*IU][=== N*random(0,p[for(i+j*t*cos(Tw,yexp(-(/2))++&&VfillZ[j+D] sin(T#(2*D+1$ 9`@];At=B=1E+(F)*G)}K0]L1]O)-QeTo(xRq-r-U+N)%NVa.Wi=^j=_k=`,1";for(Y=0;$="`_^WVURQOLKGFEBA@$#  "[Y++];)Z=_.split($),_=Z.join(Z.pop());eval(_)
@gajus
gajus / gist:5147789
Created March 12, 2013 22:44
PDO::FETCH_KEY_GROUP
PDO::FETCH_ASSOC
array(2) {
[0]=>
array(3) {
["id"]=>
int(1)
["name"]=>
string(7) "English"
["code"]=>
Type: PDOException
Message: SQLSTATE[HY000]: General error: Extraneous additional parameters
File: [project]/ay/pdo.class.php
Line: 85
Time: Mar 12, 2013 23:07
public function fetchAll ($how = null, $class_name = null, $ctor_args = null) {
if ($how === PDO::FETCH_KEY_ASSOC) {
#$result = parent::fetchAll(PDO::FETCH_ASSOC);
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}
<?php
/**
* @author Gajus Kuizinas <g.kuizinas@anuary.com>
* @version 1.7.2 (2013 07 28)
* @todo Consider adding layout attribute [label][input][name][/label][comment]
*/
function input ($name, $label = null, array $input_options = null, array $row_options = []) {
if (!isset($row_options['order'])) {
$row_options['order'] = 'label-input';
}
$GLOBALS['translation'] = [
'authentication_error' => 'You must authorise Facebook application!',
'geofence_restricted' => 'Sorry, this game is currently not available in your country.',
'terms_and_conditions' => 'Terms & Conditions',
'terms_and_conditions_url' => 'http://www.sky.com/tv/show/the-blacklist/article/facebook-game',
'privacy_policy' => 'Privacy Policy',
'privacy_policy_url' => 'http://help.sky.com/security/privacy/privacy-and-cookies-notice',
@gajus
gajus / gist:d75de7f3fdbfd6486d6a
Created September 22, 2014 08:28
"Example Factory" a factory method used to instantiate the SUT object with canonical values, overwriting only the properties relevant to the test case.
var SeminarFactory = {
create: function (overwrite) {
var defaultData,
objectData;
defaultData = {
name: 'JavaScript basics',
price: 100
};
describe('Seminar', function () {
it('has a name', function () {
var seminar = SeminarFactory.create({name: 'JavaScript'});
expect(seminar.getName()).toEqual('JavaScript');
});
it('has a price', function () {
var seminar = SeminarFactory.create({price: 10});
// The hash (#) and dot (.) symbols are a convention to mark if a method
// is called on an individual object or on the prototype. ".create" is
// called on the Cart prototype. #add are called on the derived objects.
describe('Cart', function () {
var cart;
beforeEach(function () {
cart = Cart.create();
});
describe('.create', function () {
describe('A Cart with a several different products', function () {
var cart;
beforeEach(function () {
cart = Cart.create();
});
it('must have a #grossPriceSum() of the contained products', function () {
var product = Product.create('A', 10),
book = Book.create('B', 100);