Skip to content

Instantly share code, notes, and snippets.

View jeroenbourgois's full-sized avatar
🐢

Jeroen Bourgois jeroenbourgois

🐢
View GitHub Profile
@jeroenbourgois
jeroenbourgois / vhost-proximinade-travisci.txt
Created July 31, 2012 08:04
Apache virtualhost for Travis CI
<VirtualHost *:3000>
ServerAdmin webmaster@localhost
DocumentRoot PATH
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory PATH >
Options Indexes FollowSymLinks MultiViews
@jeroenbourgois
jeroenbourgois / postgres-setup.sh
Created August 29, 2012 21:03
postgres setup on the linode
sudo su postgres
psql
postgres=# create role askbot with createdb login encrypted password 'askbot';
# --> CREATE ROLE
postgres=# create database askbot with owner=askbot;
// bad
function foo()
{
alert('Bar');
}
// good
function foo() {
alert('Bar');
}
// bad
function foo (){
alert('Bar');
}
function foo(){
alert('Bar');
}
// good
// bad
var a=0;
if(i==='ok') alert('Foo');
i+=2;
a=d*b*c;
if(a>b&&b<d||1===1) alert('Doh!');
// good
var a = 0;
if(i === 1) alert('Foo');
// bad
while( count < collection.length ) {
foo();
}
// good
while(count < collection.length) {
foo();
}
// bad
for (var i = 0; i < 10; i++) {
...
}
if (a == b) {
...
}
while (a !== 1) {
// bad
var obj = {'prop':'value', 'prop':'value', 'prop':'value'};
var obj = {'prop':'value',
'prop':'value',
'prop':'value'};
var obj = {
'prop':'value',
'prop':'value',
'prop':'value'
};
function documentReady(readyFunction) {
// I added a check here to see if addEventListener
// is known, cause IE will fail and we can stop safely then
if(document.addEventListener) {
document.addEventListener('DOMContentLoaded', function() {
document.removeEventListener('DOMContentLoaded', arguments.callee, false);
readyFunction();
}, false);
}
public function add_lead(Model_Lead $lead) {
try {
$lead->save();
} catch(Orm\ValidationFailed $e) {
$error = ['model' => $lead, 'error' => $e->get_fieldset()->validation()];
Log::error($e);
// $error['errpor'] is NULL here, and I cannot find a way
// to get the actual error messages
return $error;
}