Skip to content

Instantly share code, notes, and snippets.

View vitr's full-sized avatar
♾️

Vitaliy Ryepnoy vitr

♾️
View GitHub Profile
@nictuku
nictuku / gist:997386
Created May 29, 2011 01:47
golang union types.
// Objective: demonstrate that there are more use cases
// for union types than previously thought.
// http://groups.google.com/group/golang-nuts/browse_thread/thread/fbde059a7cfd2fa9
//
// Interface inference.
// We already have type inference, so this would be very Go-like:
type typeA int
func (x typeA) A() {}
func (x typeB) C() {}
@rodneyrehm
rodneyrehm / watermark.imagick.php
Created August 22, 2011 09:01
Watermark with IMagick
<?php
// Watermark with Imagick
// load images
$image = new Imagick("image.jpg");
$watermark = new Imagick("watermark.png");
// translate named gravity to pixel position
$position = gravity2coordinates($image, $watermark, 'lowerRight', 5, 5);
// compose watermark onto image
@sgergely
sgergely / gist:3793166
Created September 27, 2012 09:43
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
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';

package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}
@aswebdev
aswebdev / australian-states-select.html
Created June 12, 2014 04:00
HTML Select - List of Australian States
<select name="state">
<option value="ACT">Australian Capital Territory</option>
<option value="NSW">New South Wales</option>
<option value="NT ">Northern Territory</option>
<option value="QLD">Queensland</option>
<option value="SA ">South Australia</option>
<option value="TAS">Tasmania</option>
<option value="VIC">Victoria</option>
<option value="WA ">Western Australia</option>
</select>
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active May 13, 2024 12:38
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@avenet
avenet / choco.bat
Created October 25, 2014 15:09
Installs Chocolatey and my preferred Windows programs
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install Atom
choco install notepadplusplus.install
choco install 7zip
choco install flashplayerplugin
choco install vlc
choco install nodejs
choco install vcredist2010
choco install PowerShell
@RadTechDad
RadTechDad / BenSmith_Annotations.xml
Last active October 23, 2018 03:06
BenSmith - PHPStorm Live Templates
<templateSet group="BenSmith-Annotations">
<template name="anno" value="/**&#10;* $ANNOTATIONS$&#10;* @return Response&#10;*/" description="Add docblock ready for annotations below" toReformat="false" toShortenFQNames="true">
<variable name="ANNOTATIONS" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
<option name="PHP" value="true" />
</context>
</template>
<template name="@G" value="@Get(&quot;$ROUTE$&quot;, as=&quot;$NAME$&quot;)" description="Get route annotation" toReformat="false" toShortenFQNames="true">
@sourcec0de
sourcec0de / docker-compose-coreos.sh
Created November 30, 2015 19:39
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose