Skip to content

Instantly share code, notes, and snippets.

View GromNaN's full-sized avatar
🚲
☀️

Jérôme Tamarelle GromNaN

🚲
☀️
View GitHub Profile
@JeremyJames
JeremyJames / Shortcuts.md
Last active August 29, 2015 14:15
SublimeText shortcuts

Packages

  • Alignment (CMD + CTRL + A)
  • DocBlockR (Start commenting + push tab or enter)
  • GitGutter (Highlight lines changed, compare files, etc.)
  • Package control (Mandatory on Sublime)
  • Php-Twig
  • PhpNamespace (ALT + I, ALT + U)
  • TrailingSpaces (Can be triggered on save, check user config)
  • Unicode Character Highlither (Highlight non breaking spaces for example)
@ezzatron
ezzatron / clean-use.php
Created May 9, 2011 12:10
Script to clean unnecessary PHP use statements
#!/usr/bin/env php
<?php
$paths = array();
if (isset($_SERVER['argv']))
{
$paths = $_SERVER['argv'];
array_shift($paths);
if (!$paths)
@GromNaN
GromNaN / array_flatter.php
Created June 21, 2011 13:52
array_flatter
<?php
/**
* Convert a multi-dimensions array to a 1 flat array.
*
* @param array $array
* @param string $separator
* @param string $prefix
* @return array
*/
@chanmix51
chanmix51 / app.nginx.conf
Created August 17, 2011 08:45
nginx vhost conf silex & symfony
server {
listen 80;
server_name server.mydomain.net
root /var/www/app/web;
index index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
@dzaporozhets
dzaporozhets / gitlab_gitolite.sh
Created October 24, 2012 13:58
Fix gitolite for gitlab 3
# GITOLITE 3
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\1'\.\*'/g" /home/git/.gitolite.rc
# GITOLITE 2
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\1"\.\*"/g' /home/git/.gitolite.rc
@igorw
igorw / FooController.php
Last active December 11, 2015 01:38
Convention-based Reflection Controller Provider for Silex.
<?php
// src/Igorw/FooController.php
namespace Igorw;
class FooController
{
function getIndexAction()
{
import React from 'react';
class EmbedIframe extends React.Component {
resizeIframe = () => {
const height = Math.max(this.props.minHeight, this.iframe.contentWindow.document.body.offsetHeight);
this.iframe.height = `${height}px`;
}
componentDidMount = () => {
@pjedrzejewski
pjedrzejewski / Symfony3Forms.php
Created December 11, 2015 09:01
Issues with removing form type names in Symfony 3.0.
<?php
class ResourceAutocompleteType extends AbstractType
{
// ...
private $resourceName;
public function __construct($resourceName)
{
@juliendufresne
juliendufresne / analyze.sh
Created April 16, 2016 22:26
Remove large files and directories from git history
#!/bin/bash
# First we need to find the big files
# source: https://stackoverflow.com/questions/10622179/how-to-find-identify-large-files-commits-in-git-history/20460121#20460121
REPO_URL="git@domain.tld:your-repo-here.git"
WORKING_DIR=$(mktemp -d);
cd "${WORKING_DIR}"
git clone --mirror "${REPO_URL}" source.git;
class MoneyType extends AbstractType implements DataMapperInterface
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('amount', 'integer')
->add('currency', 'string')
->setDataMapper($this)
;
}