Skip to content

Instantly share code, notes, and snippets.

View radutopala's full-sized avatar
🦅
Building in Go @trisoftro #golang

Radu Topala radutopala

🦅
Building in Go @trisoftro #golang
View GitHub Profile
@radutopala
radutopala / delete.class.php
Created May 29, 2012 08:28
Delete row action
<?php
class deleteAction extends sfAction
{
public function execute($request)
{
if ($request->isMethod('post')) {
$fhr = MyModelQuery::create()->findPk($this->getRequestParameter('id'));
@radutopala
radutopala / skillEditNotOpenAction.class.php
Created July 17, 2012 09:29
Example of closing or opening popup after submit
<?php
// not opening the popup again after submitting
class skillEditAction extends simpleWidgetEditAction
{
public function execute($request)
{
if ($request->isMethod('post')) {
if ($this->processPostData()) {
$result = array(
@radutopala
radutopala / User.php
Created September 9, 2012 17:37
User class
<?php
/*
* @author Radu Topala <radu.topala@trisoft.ro>
*/
class User
{
protected $id;
@radutopala
radutopala / MyModelPeer.php
Created September 18, 2012 10:21
Tree Widget example
<?php
class MyModelPeer extends BaseMyModelPeer {
public static function getStats($id)
{
//use $id for something
$stats['company1']['product1'] = array('items'=>5, 'price'=>5*10);
$stats['company1']['product2'] = array('items'=>9, 'price'=>9*2);
@radutopala
radutopala / cleanup_git_svn.sh
Last active December 26, 2015 10:19
Clean svn dirs from a git repo
#!/bin/bash
find . -name .svn -print0 | xargs -0 rm -r
paths=`git ls-files --deleted`
for path in $paths
do
echo ${path} to be removed
git rm -r $path
@radutopala
radutopala / gist:7370100
Created November 8, 2013 12:06
Symfony2 app - updating composer.lock file when "Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them." appears.
php -dmemory_limit=-1 /usr/bin/composer update --lock
@radutopala
radutopala / ubuntu1204php54.sh
Last active August 29, 2015 14:05
Ubuntu 12.04 with PHP5.4 without mysql-server on AWS
#!/bin/bash
echo ‘LC_ALL=en_US.UTF-8’ > /etc/environment
echo ‘LANG=en_US.UTF-8’ >> /etc/environment
apt-get install -y python-software-properties
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update -y && apt-get -y upgrade && apt-get -y dist-upgrade
apt-get install -y php5
apt-get install php5-cli
apt-get install -y curl apache2 git php5-curl php5-intl
@radutopala
radutopala / ubuntu14.04php5.5.sh
Last active August 29, 2015 14:05
Ubuntu 14.04 with PHP5.5 without mysql-server on AWS
#!/bin/bash
echo ‘LC_ALL=en_US.UTF-8’ > /etc/environment
echo ‘LANG=en_US.UTF-8’ >> /etc/environment
apt-get update -y && sudo apt-get -y dist-upgrade
apt-get install -y curl
apt-get install -y apache2
apt-get install -y php5
apt-get install php5-cli
apt-get install -y git
@radutopala
radutopala / vdom-diff.js
Last active August 29, 2015 14:17
virtual dom diff test
var parser = require('html2hscript'),
redis = require("redis"),
client = redis.createClient(),
util = require('util'),
diff = require('virtual-dom/diff'),
patches, content, oldTree = '';
client.on("error", function (err) {
console.log("Error " + err);
});
@radutopala
radutopala / mover.go
Created June 7, 2015 18:37
Moving files with go
package main
import (
"fmt"
"io"
"os"
s "strings"
"github.com/kr/fs"
)