Skip to content

Instantly share code, notes, and snippets.

View feyyazesat's full-sized avatar

Feyyaz Esatoglu feyyazesat

View GitHub Profile
@feyyazesat
feyyazesat / validationannotation.php
Created August 26, 2015 10:32
validation annotation.
/**
* @var string
*
* @ORM\Column(name="firstname", type="string", length=45, nullable=true)
* @Assert\Length(
* min = 2,
* max = 45,
* minMessage = "user.form.validation.firstname.min",
* maxMessage = "user.form.validation.firstname.max",
* groups = {"personal_info"}
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)
- http://www.alexedwards.net/blog/golang-response-snippets
- https://devcharm.com/articles/8/go-nethttp-handlers/
- http://openmymind.net/Things-I-Wish-Someone-Had-Told-Me-About-Go/
- https://elithrar.github.io/article/custom-handlers-avoiding-globals/
- https://elithrar.github.io/article/map-string-interface/
- https://elithrar.github.io/article/approximating-html-template-inheritance/
- http://blog.golang.org/error-handling-and-go
- https://golang.org/doc/articles/wiki/
- https://medium.com/@benbjohnson/structuring-applications-in-go-3b04be4ff091
- https://justinas.org/best-practices-for-errors-in-go/
@feyyazesat
feyyazesat / ymlstruct.go
Created March 9, 2015 00:26
simmetrica graph yaml struct
type Yaml struct {
Graphs []struct {
Title string
Timespan string
Colorscheme string
Type string
Interpolation string
Resolution string
Size string
Offset string
@feyyazesat
feyyazesat / connectionpooling.go
Last active August 29, 2015 14:17 — forked from rday/gist:3504674
An example of connection pooling.
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
@feyyazesat
feyyazesat / connectionpoolingimplementation.go
Created March 17, 2015 18:56 — forked from rday/gist:3504712
an example of connection pooling implementation.
/**
This function creates a connection to the database. It shouldn't have to know anything
about the pool, It will be called N times where N is the size of the requested pool.
*/
func initCirrusConnections() (interface{}, error) {
dbserver, _ := configFile.GetString("default", "dbserver")
dbuser, _ := configFile.GetString("default", "dbuser")
dbpass, _ := configFile.GetString("default", "dbpass")
db := autorc.New("tcp", "", dbserver, dbuser, dbpass)
#!/bin/bash
# include config
# config example below:
#
#
# Example deploy_config.sh
#
# dev_env() {
# Symfony bin path
set :bin_path, "bin"
# Symfony var path
set :var_path, "var"
# Symfony console path
set :symfony_console_path, fetch(:bin_path) + "/console"
# Symfony log path
{
"events":[
{
"title":"the foo party",
"lat":1111,
"long":1111,
"description":"go to the party, surely you will have fun!",
"startDate":1111 // unixtimestamp
}
]
@feyyazesat
feyyazesat / multicomposer.sh
Last active December 24, 2015 13:30
Composer multiplier
#!/bin/bash
export SYMFONY_APP=$1
composer ${@:2}
# --usage ./multicomposer.sh api install