Skip to content

Instantly share code, notes, and snippets.

Simon Males sime

Block or report user

Report or block sime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sime
sime / opensourceberlin
Last active Aug 29, 2015
Open Source Berlin
View opensourceberlin
Companies whose core product is open source and actively developed in Berlin.
* CartoDB
* Crate.io
* Fairnopoly
@sime
sime / o2_google.txt
Last active Aug 29, 2015
o2 resolving Google CDN static content
View o2_google.txt
# o2 ADSL, Berlin Mitte
# Using cURL, fetch the jQuery library within ten seconds.
$ curl -m 10 http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
curl: (28) Connection timed out after 10005 milliseconds
# Content from ajax.googleapis.com (and fonts.googleapis.com) time out!
@sime
sime / delete_cookie.js
Created Jul 15, 2011
Delete a cookie with JS
View delete_cookie.js
@sime
sime / schema.php
Created Feb 26, 2012
Possible example of using the CakePHP Schema callback `after` to insert content in the database
View schema.php
<?php
// Possible example of using the CakePHP Schema callback `after`
// to insert content in the database.
// Inspiration: https://github.com/majna/schema
// Copy schema.php to app/Config/Schema
// Run: ./Console/cake schema create
App::uses('ClassRegistry', 'Utility');
class AppSchema extends CakeSchema {
@sime
sime / database.php.pagoda
Created Mar 22, 2012
Pagoda Boxfile for CakePHP
View database.php.pagoda
<?php
// Source: http://help.pagodabox.com/customer/portal/articles/174049-cakephp#setting-global-server-variables-in-database-php
define("DB_HOST", $_SERVER['DB1_HOST']);
define("DB_NAME", $_SERVER['DB1_NAME']);
define("DB_USER", $_SERVER['DB1_USER']);
define("DB_PASS", $_SERVER['DB1_PASS']);
define("DB_PORT", $_SERVER['DB1_PORT']);
class DATABASE_CONFIG {
@sime
sime / AppController.php
Created Aug 27, 2012
Basic Auth in CakePHP on json request
View AppController.php
class AppController extends Controller
{
public $components = array(
'RequestHandler',
'Auth',
);
public function beforeFilter() {
$this->__setupAuth();
@sime
sime / paradigm_startups.txt
Created Oct 17, 2012
Paradigm for Startups
View paradigm_startups.txt
Ideas are worthless without execution
Execution is worthless without traction
Traction is worthless without revenue
Revenue is worthless without profit
@sime
sime / canidothisbetter.rb
Created Oct 24, 2012
Am I this this in a nicer way?
View canidothisbetter.rb
if employee_skills.has_key?(skill_name) then
employee_skills[skill_name] += 1
else
employee_skills[skill_name] = 1
end
@sime
sime / gist:4490017
Created Jan 9, 2013
Build native MySQL gem extension when using MacPorts
View gist:4490017
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/opt/local/lib/mysql55/bin/mysql_config
@sime
sime / core.php
Last active Dec 12, 2015
When running CakePHP on Heroku, by default you'll see file permission errors. The Heroku filesystem is read-only, but '/tmp' and '/log' are writable. To remove the errors update Config::config() in core.php
View core.php
<?php
// Heroku Read-only Filesystem https://devcenter.heroku.com/articles/read-only-filesystem
/**
* Configure the cache used for general framework caching. Path information,
* object listings, and translation cache files are stored with this configuration.
*/
Cache::config('_cake_core_', array(
'engine' => $engine,
'prefix' => $prefix . 'cake_core_',
You can’t perform that action at this time.