Skip to content

Instantly share code, notes, and snippets.

@ryanzhou
ryanzhou / pf.md
Last active October 21, 2019 03:52
Getting Pow to work in OS X Yosemite

Getting Pow to work in OS X Yosemite

Some parts taken from: https://gist.github.com/kujohn/7209628

ipfw is officially deprecated and removed in OS X Yosemite. Pow requires another program pf to handle the port forwarding.

1. Anchor file

Create file /etc/pf.anchors/pow

services:
log.handler.db:
class: "Vendor\\Log\\Handler\\Db"
arguments:
manager: @em
logger.db:
class: "Monolog\\Logger"
arguments:
name: "db"
calls:
@pakaufmann
pakaufmann / TranslatedFieldType.php
Created May 15, 2012 13:16 — forked from qrizly/TranslatedFieldType.php
Changed a couple of things. Languages are now dynamic and a default language can be used which won't be written into a translation object but directly into the object itself so it can be used like in this blog post: http://knplabs.fr/blog/I%28blah...blah.
<?php
namespace ExampleBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Edge5\TestProjectBundle\Form\addTranslatedFieldSubscriber;
@odracci
odracci / .bashrc
Created March 18, 2012 13:49 — forked from trumbitta/.bash_aliases
My version with tweaks and inspiration from holman/dotfiles
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_unpushed {
local unpushed=`/usr/bin/git cherry -v origin/$(get_git_branch) 2> /dev/null`
[[ "$unpushed" != "" ]] && echo "$(tput setaf 1) ++> $(tput sgr0)"
}
@Yavari
Yavari / README.markdown
Created February 23, 2012 09:00 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@elranu
elranu / app.js
Created November 24, 2011 15:29
Socket.IO RedisStore and Rooms
//app.js Socket IO Test
var app = require('express').createServer(),
redis = require('socket.io/node_modules/redis'),
io = require('socket.io').listen(app);
var pub = redis.createClient(port, "url");
var sub = redis.createClient(port, "url");
var store = redis.createClient(port, "url");
pub.auth('pass', function(){console.log("adentro! pub")});
sub.auth('pass', function(){console.log("adentro! sub")});
<?php
protected function _editAction(Post $post)
{
$em = $this->get('doctrine.orm.default_entity_manager');
$factory = $this->get('form.factory');
$form = $factory->create(new PostFormType());
$form->setData($post);
if ($this->get('request')->getMethod() === 'POST') {
@odracci
odracci / UploadImageInSymfonyForm.php
Created August 5, 2010 09:06
sfWidgetFormInputFileEditable
<?php
$this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array(
'label' => 'Image',
'file_src' => sprintf('/uploads/%s/%s', sfConfig::get('app_upload_image_path', 'images') ,$this->getObject()->getImage()),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => '<div>%file%<br />%input%<br />%delete% %delete_label%</div>',
));
$this->validatorSchema['image_delete'] = new sfValidatorBoolean();