Skip to content

Instantly share code, notes, and snippets.

View Shaked's full-sized avatar

Shaked Klein Orbach Shaked

View GitHub Profile
<?php
/* rest of the code here */
/**
* @dataProvider providerUseInString
*/
public function testUseInString($expected, $input)
{
$fixer = new UnusedUseStatementsFixer();
@Shaked
Shaked / msa.go
Created August 22, 2014 12:39
map-vs-slice-vs-array.go
package main
import "log"
const (
KEY_1 = iota
KEY_2
KEY_3
KEY_4
KEY_5
@Shaked
Shaked / msa_test.go
Created August 22, 2014 12:40
maps-vs-slice-vs-array-test.go
package main
import "testing"
var keys = randomKeys()
func BenchmarkDeferRecoverPanicMap(b *testing.B) {
for n := 0; n < b.N; n++ {
deferRecoverPanicMap()
}
@Shaked
Shaked / msa.go
Last active August 29, 2015 14:05
MapsVsSlicesVsArrays
package main
import "math/rand"
var amount = 1000
func main() {
deferRecoverPanicMap()
deferRecoverPanicSliceExpandable()
deferRecoverPanicSliceFixedSize()
@Shaked
Shaked / complex.go
Last active August 29, 2015 14:05
ComplexMapsVsSlicesVsArrays
package main
import (
"io"
"math/rand"
"strings"
)
var amount = 1000
@Shaked
Shaked / plugin.py
Created August 25, 2014 15:25
pelican_gist_including_drafts
# -*- coding: utf-8 -*-
"""
Gist embedding plugin for Pelican
=================================
This plugin allows you to embed `Gists`_ into your posts.
.. _Gists: https://gist.github.com/
"""
<?php
namespace Domain;
use Symfony\Component\Validator\Constraints\Null as Null;
class CodeSnifferShellCommand implements ShellCommand {
private $bin;
private $codePath;
private $handleStdOutCallback;
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/a/", func(w http.ResponseWriter, r *http.Request) {
@Shaked
Shaked / SerializingUserObject.php
Created August 23, 2015 21:14
Serializing User Object
<?php
class User implements JsonSerializable {
private $name;
private $email;
private $facebookId;
public function __construct($name, $email, $facebookId) {
$this->name = $name;
$this->email = $email;
$this->facebookId = $facebookId;
@Shaked
Shaked / UserObjectAndJsonUserObject.php
Created August 23, 2015 21:18
User Object and JsonUser Object
<?php
class User {
private $name;
private $email;
private $facebookId;
public function __construct($name, $email, $facebookId) {
$this->name = $name;
$this->email = $email;
$this->facebookId = $facebookId;