Skip to content

Instantly share code, notes, and snippets.

View androa's full-sized avatar

André Roaldseth androa

View GitHub Profile
@androa
androa / gist:805991
Created February 1, 2011 15:16
Testing both return value and E_NOTICE/E_USER_NOTICE
<?php
class ClassWithError {
public function multiplyByTen($value = 0) {
if (!$value) {
trigger_error('Value is missing', E_USER_NOTICE());
return false;
}
return $value * 10;
}
@androa
androa / updateUserAgent.html
Created February 22, 2012 12:29
Detecting old browsers
<style type="text/css">
#warningBox div { display: none; }
</style>
<div id="warningBox">
<div class="opera">
<h1>Du bruker en eldre versjon av nettleseren Opera</h1>
<p>For å få en best mulig opplevelse av våre nettsider, anbefaler vi at du henter <a href="http://www.opera.no/browser/">nyeste versjon av Opera</a>. Bruker du en jobb-PC bør du kontakte IT-ansvarlig.</p>
@androa
androa / Bootstrap.php
Created May 31, 2012 12:25
Lazyloading resources from the Zend Framework bootstrap
<?php
/**
* Example Zend Framework bootstrap with lazyloading of resources
*
* @author André Roaldseth <andrer@vg.no>
*/
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
/**
* Creates a lazyloaded Memcached instance
*
@androa
androa / public-js-bootstrap.js
Created August 15, 2012 10:10
r.js 2.x is not building in the same manner as r.js 1.x
define(function(){
var requireJsConfig = {
enforceDefine: true,
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_',
deps: ['jquery']
@androa
androa / .svn_completion_remote_paths.sh
Created December 19, 2012 13:21
A tiny implementation of bash auto completion of remote paths when using Subversion. Requires that you have a working copy and are using ^/ to indicate that it's a remote url. Add the following file and add "source ~/.svn_completion_remote_paths" to your ~/.bash_profile
#!/bin/bash
function complete_remote_paths() {
word_to_complete=${COMP_WORDS[COMP_CWORD]}
command_line=${COMP_LINE}
# If the command line contains ^/ we should start completing
if [[ "$command_line" == *^/* ]]; then
# Create a base path for svn to use which only contains complete folder
# names. Examples:
# ^/bra => ^/
@androa
androa / ZF2 issue #4879
Created September 12, 2013 15:06
ZF2 issue #4879
diff --git a/library/Zend/I18n/Translator/Translator.php b/library/Zend/I18n/Translator/Translator.php
index 5b2c156..bd717ac 100644
--- a/library/Zend/I18n/Translator/Translator.php
+++ b/library/Zend/I18n/Translator/Translator.php
@@ -232,6 +232,18 @@ class Translator
}
/**
+ * Check if the translator has the sufficient configuration to actually
+ * perform translations.
@androa
androa / master.php
Last active December 24, 2015 23:48
<?php
$cnn = new AMQPConnection();
$cnn->connect();
$ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchangeName');
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declareExchange();
@androa
androa / imbo-install
Last active August 29, 2015 14:06
Imbo installer
#!/bin/bash
curl -sS https://getcomposer.org/installer | php
php composer.phar create-project -sdev --no-interaction androa/imbo-bootstrap $1
@androa
androa / Dockerfile
Last active August 29, 2015 14:08
Dockerifing Imbo
# DOCKER-VERSION 1.0.1
FROM ubuntu:14.04
# Install necessary software for Imbo Web servers.
RUN apt-get update && apt-get -y install curl php5 apache2 php5-json php5-imagick php5-mongo php5-memcached
# Add the source code of Imbo
COPY . /imbo
# Install necessary Imbo dependencies.

Keybase proof

I hereby claim:

  • I am androa on github.
  • I am androa (https://keybase.io/androa) on keybase.
  • I have a public key whose fingerprint is 4690 59F2 FA4E A51C 6F61 C818 49CE 5591 E4DB 9B61

To claim this, I am signing this object: