Skip to content

Instantly share code, notes, and snippets.

View estahn's full-sized avatar
👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ

Enrico Stahn estahn

👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ
View GitHub Profile
@estahn
estahn / gist:703556
Last active September 24, 2015 06:08
Doctrine - Versionable behavior configuration for use in symfony
Authority:
columns:
...
actAs:
Versionable:
className: '%CLASS%Versionable'
tableName: '%TABLE%_log'
deleteVersions: false
auditLog: true
generateFiles: true
bash-3.2# ps x | grep vmnet
919 ?? S 0:00.10 /Library/Application Support/VMware Fusion/vmnet-bridge
923 ?? Ss 0:00.02 /Library/Application Support/VMware Fusion/vmnet-dhcpd -s 13 -cf /Library/Application Support/VMware Fusion/vmnet1/dhcpd.conf -lf /var/db/vmware/vmnet-dhcpd-vmnet1.leases -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1
925 ?? Ss 0:00.00 /Library/Application Support/VMware Fusion/vmnet-netifup -s 13 -d /var/run/vmnet-netif-vmnet1.pid vmnet1 vmnet1
927 ?? Ss 0:00.02 /Library/Application Support/VMware Fusion/vmnet-dhcpd -s 13 -cf /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf -lf /var/db/vmware/vmnet-dhcpd-vmnet8.leases -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8
930 ?? S 0:00.06 /Library/Application Support/VMware Fusion/vmnet-natd -s 13 -m /Library/Application Support/VMware Fusion/vmnet8/nat.mac -c /Library/Application Support/VMware Fusion/vmnet8/nat.conf
932 ?? Ss 0:00.00 /Library/Application Support/VMware Fusion/vmnet-netifu
@estahn
estahn / gist:743291
Created December 16, 2010 11:10
Apple Script to start VMware Fusion lazy
set isRunning to do shell script "ps -ef | grep vmnet | grep -v grep | wc -l |sed 's/ //g'"
if isRunning is "0" then
do shell script "/Library/Application\\ Support/VMware\\ Fusion/boot.sh --start" with administrator privileges
end if
tell application "VMware Fusion" to activate
@estahn
estahn / gist:1055981
Created June 30, 2011 10:30
Headless Testing for Continuous Integration with Ruby and Selenium
# Install and run xvfb
apt-get install xvfb
Xvfb -ac :99
# Get Firefox
wget -O firefox-5.0.tar.bz2 "http://download.mozilla.org/?product=firefox-5.0&os=linux&lang=en-US"
tar xfj firefox-5.0.tar.bz2
mv firefox firefox-5.0
# Get Selenium Server
@estahn
estahn / env.rb
Created July 6, 2011 11:20
Run Cucumber with Selenium RC and a custom Firefox profile
if ENV.key?('SELENIUM_REMOTE')
Capybara.register_driver :selenium do |app|
require 'selenium-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.from_name 'default'
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
Capybara::Selenium::Driver.new(app, { :browser => :remote, :desired_capabilities => capabilities })
end
end
@estahn
estahn / rack_hotfix.rb
Created July 8, 2011 09:46
"warning: regexp match /.../n against to UTF-8 string" when running Cucumber
# TODO: Can be removed after updating to rack 1.3.0
module Rack
module Utils
def escape(s)
CGI.escape(s.to_s)
end
def unescape(s)
CGI.unescape(s)
end
end
@estahn
estahn / _compass-retina-sprites.scss
Created October 5, 2012 00:32
Using Compass to generate normal and retina sprite maps at once
@mixin all-retina-sprites($map, $map2x) {
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
$base-class: sprite-map-name($map);
.#{$base-class}-all-retina-sprites {
@estahn
estahn / svn-remove-stale-branches.sh
Created December 2, 2012 07:56
Remove branches that belong to closed tickets
#!/bin/bash
# Base Repository URL
SVN_URL=http://svn-repo-url
# Atlassian Jira URL
JIRA_URL=https://jira-url
# Jira Project Key
PROJECT=project-key
@estahn
estahn / gist:5002290
Created February 21, 2013 05:13
Our current framework is heavily using a "Factory" to instantiate classes on the fly. It used ReflectionClass::newInstanceArgs() for classes with arguments. Since Reflection is quite slow it decreased our performance. The gist shows a solution that is less beautiful but more performant.
<?php
class Factory
{
// ...
/**
* Helper to instantiate objects with dynamic constructors.
*
@estahn
estahn / remove_old_chrome_versions.sh
Created October 3, 2013 11:59
Free up disk space by deleting older Google Chrome versions
#!/bin/bash
current=`find /Applications/Google\ Chrome.app/Contents/Versions -maxdepth 1 -type d -name "*.*.*.*" | sort | tail -1 | xargs -I% basename %`
echo Deleting old Chrome versions and keep $current
find /Applications/Google\ Chrome.app/Contents/Versions -maxdepth 1 -type d -name "*.*.*.*" -not -iname "$current" -exec rm -rf {} +