Skip to content

Instantly share code, notes, and snippets.

View vitr's full-sized avatar
♾️

Vitaliy Ryepnoy vitr

♾️
View GitHub Profile
@vitr
vitr / keybase.md
Last active October 11, 2019 11:03

Keybase proof

I hereby claim:

  • I am vitr on github.
  • I am vitr (https://keybase.io/vitr) on keybase.
  • I have a public key ASCeKWk4UVeLJhx2NzSC40i8gAc-UlqPCbx-QysJqYaA7Qo

To claim this, I am signing this object:

change
preg_match('/^([a-z]+)\.\1ID$/i', $args[0]
to
preg_match('/^(.*)ID$/i', $args[0]
@vitr
vitr / eloquent.md
Created November 27, 2016 11:33 — forked from msurguy/eloquent.md
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

php artisan migrate:refresh --force; php artisan db:seed --force
<?
$music()->
filter(function ($value,$key) {
if(strtolower($key) == 'music type' && strtolower($value) == 'jazz')
{
return true;
} else {
return false;
}
})->
@vitr
vitr / 0_reuse_code.js
Created April 2, 2016 10:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vitr
vitr / gist:9526826
Created March 13, 2014 11:38
Plupload 2 image dimensions filter
{
}
####################################################################################
## ##
## gittyup() - Easily keep master in sync with upstream. ##
## ##
## Author: Evan Coury, http://blog.evan.pro/ ##
## URL: https://gist.github.com/1506822 ##
## ##
## This bash function is a simple shortcut for keeping your local (and public ##
## fork / origin remote) master branch up to date and in sync with the upstream ##
## master. To use gittyup(), simply drop this in your ~/.bashrc. ##
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){