Skip to content

Instantly share code, notes, and snippets.

@jehaby
jehaby / index.php
Created July 29, 2015 18:58
test gist
echo 'hw!';
@jehaby
jehaby / data
Created November 6, 2015 20:51
{ "items": [
{"firstName": "Who", "lastName": "Chu", "education": "college", "towns": "Moscow"}
]}
@jehaby
jehaby / config.yml
Created March 22, 2016 08:22
Normalize keys question
liip_imagine:
normalize_keys: false
some_values:
which-i-want-to-see-with-dashes:
..
because-my-boss-wants-dashes:
@jehaby
jehaby / Apicontroller.php
Created March 30, 2016 14:19
2 of one fields valid
<?php
namespace AppBundle\Controller;
...
class ApiController extends Controller
{
/**
* @Route("...")
@jehaby
jehaby / SomeController.php
Last active April 12, 2016 11:01
Static pages with Symfony
<?php
class SomeController extends Controller {
/**
* @Route("/speaker/{slug}", name="speaker")
*/
public function speakerAction($slug)
{
@jehaby
jehaby / post-merge
Last active May 5, 2016 07:14
git hooks for Symfony deploy
#!/bin/bash
# for Symfony 3.0+
./bin/console cache:clear -e prod
#for Symfony 2*
./app/console cache:clear -e prod
@jehaby
jehaby / array_replace_recursive_overwrite.php
Created May 10, 2016 10:06
Enchantment of PHP's array_replace_recursive
<?php
if (!function_exists('array_replace_recursive_overwrite')) {
function array_replace_recursive_overwrite($array, $array1)
{
$recurse = function ($array,$array1) use (&$recurse)
{
foreach ($array1 as $key => $value) {
@jehaby
jehaby / wtf.go
Created April 3, 2017 14:49
proof
This file has been truncated, but you can view the full file.
-*- mode: grep; default-directory: "/usr/local/go/src/" -*-
Grep started at Mon Apr 3 17:48:57
find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \
/*
go test str_conc_test.go -bench . -benchtime 10s
BenchmarkConcatOne-4 2000000 7684 ns/op
BenchmarkConcatTwo-4 5000000 2883 ns/op
BenchmarkConcatThree-4 5000000 2933 ns/op
PASS
ok command-line-arguments 56.982s
*/
package main
@jehaby
jehaby / remove_keys.yml
Created August 8, 2017 16:29 — forked from sgargan/remove_keys.yml
Removing unknown keys from authorized keys with Ansible
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: add a couple of keys to an authorized_keys file
authorized_key: path='./keys' user=sgargan key="{{ lookup('file', './ansible.pub') }}"
- authorized_key: path='./keys' user=sgargan key="{{ lookup('file', './sgargan.pub') }}"