Skip to content

Instantly share code, notes, and snippets.

View alright's full-sized avatar
🇺🇦

Evgeny Tronchuk alright

🇺🇦
View GitHub Profile

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@alright
alright / gist:1698905
Last active September 30, 2015 01:18
Vkontakte API class
<?php
class Vkapi {
protected static $_client_id = 0;
protected static $_access_token = '%access_token%';
public static function invoke ($name, array $params = array())
{
$params['access_token'] = self::$_access_token;
@alright
alright / gist:1479977
Last active September 19, 2022 18:41
Vkontakte API
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
class Vkapi {
protected $_access_token = '';
protected $_client_id = 0;
protected $_version = '5.0';
<?php
function named_args (array $args, array $settings = array())
{
$native_types = array('boolean', 'integer', 'float', 'null', 'string', 'object', 'array', 'callable', 'resource');
foreach ($settings AS $name => $arg)
{
$type = NULL;
$required = FALSE;
@alright
alright / gist:1107183
Last active September 26, 2015 13:57
Intuitive sorting of arrays in PHP
<?php
// Predefined constants
define('DO_SORT_BY_VALUE', 1);
define('DO_SORT_BY_KEY', 2);
define('DO_SORT_ASC', 1);
define('DO_SORT_DESC', 2);
define('DO_SORT_NATURAL', 3);
define('DO_SORT_NATURAL_CASE', 4);
define('DO_SORT_RANDOM', 5);
N = [K = R.getContext('2d')];
for (t = B = 127, I = K.getImageData(0, 0, q = 64, q); t--; $ = Math.cos) N[t] = t / 43 & 1;
setInterval("t++;for(i=y=-1;y<1;y+=A)for(x=-1;x<1;x+=A=1/32,I.data[i+=4]=h+h)for(m=C=$(a=t/86),S=$(a+8),c=$(b=t/B),s=$(b+8),u=x*C+S,v=y*c-u*s,u=u*c+y*s,w=C-x*S,X=q+9*$(a+b),Y=q+9*$(b-a),Z=t,h=B;--h&&m<q;X+=u,Y+=v,Z+=w)for(m=1;N[X*m&B]+N[Y*m&B]+N[Z*m&B]<2&&m<q;m*=3);K.putImageData(I,0,0)", 9)