Skip to content

Instantly share code, notes, and snippets.

View flug's full-sized avatar
:octocat:
yeah yeah yeah

Flug flug

:octocat:
yeah yeah yeah
View GitHub Profile
@flug
flug / nginx cakephp.conf
Created February 15, 2014 17:53
Configuration for Cakephp Framework
server {
listen 80;
server_name example.com;
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
root /home/me/workspace/example/app/webroot/;
charset utf-8;
index index.php index.html index.htm;
location ~* \.(js|css|html?|xml|gz|jpe?g|gif|png|swf|wmv|flv|ico)$ {
namespace Fmdb\CoreBundle\Composer;
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler as BaseScriptHandler;
use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Process\Process;
class ScriptHandler extends BaseScriptHandler
{
public static function installBowerAssets($event)
{
@flug
flug / gist:0e4b91b1828b1d61acc3
Created June 13, 2014 16:07
Sort process by memory and kill the biggest proccess
ps ax --sort %cpu --format pid|tail -n 1|xargs kill

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@flug
flug / composer-update.sh
Last active August 29, 2015 14:07
dynamize
function composer-update (){
echo "-- composer update --"
$(which hhvm) $(which composer) self-update
$(which hhvm) $(which composer) update -vvv --profile --no-scripts && $(which php) $(which composer) run-script post-update-cmd
echo "-- composer update end --"
}

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@flug
flug / README.md
Created January 7, 2015 09:15
FosUserBundle without other bundles
    entity.admin.user.entity.class: My\WebBundle\Entity\User
    admin_user.user_manager:
        class: FOS\UserBundle\Doctrine\UserManager
 arguments: [@security.encoder_factory, @fos_user.util.username_canonicalizer, @fos_user.util.email_canonicalizer, @fos_user.entity_manager,%entity.admin.user.entity.class% ]
@flug
flug / gist:2295dd95dc9a147695ac
Created March 5, 2015 14:23
hhvm with composer other method for using composer with hhvm
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 /bin/composer
#!/usr/bin/env zsh
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
setopt promptsubst
autoload -U add-zsh-hook
ROOT_ICON_COLOR=$FG[111]
MACHINE_NAME_COLOR=$FG[208]
PROMPT_SUCCESS_COLOR=$FG[103]
PROMPT_FAILURE_COLOR=$FG[124]
echo Bonjour $USER, nous sommes le `date +"%A %e %B %Y"`, et il est : `date +"%H"` h `date +"%M"` | cowsay -f $(/bin/ls /usr/share/cowsay/cows -1 | head -n $(expr $$$(date +%s) % $(ls /usr/share/cowsay/cows | wc -w) + 1) | tail -n 1)