Skip to content

Instantly share code, notes, and snippets.

View olivierobert's full-sized avatar

Olivier Robert olivierobert

View GitHub Profile
@olivierobert
olivierobert / rails http status codes
Created February 3, 2017 02:51 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@olivierobert
olivierobert / CI Detect Ajax
Created November 22, 2012 09:26
Code Igniter // Detect and return AJAX / JSON response
/** Within the controller method **/
// If this is an ajax request, then return a JSON string
if ( $this->input->is_ajax_request() ):
$this->output->set_content_type('application/json');
$this->output->set_output( json_encode($data) );
endif;
@olivierobert
olivierobert / gist:4070041
Created November 14, 2012 03:16 — forked from lincolnthree/gist:1204112
Bootstrap
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/socialpm-web/javax.faces.resource/bootstrap.css.xhtml" /><link type="text/css" rel="stylesheet" href="/socialpm-web/javax.faces.resource/docs.css.xhtml" /><link type="text/css" rel="stylesheet" href="/socialpm-web/javax.faces.resource/prettify.css.xhtml" />
<title>SocialPM » New Project</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Cache-Control" content="must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Mon, 1 Aug 1999 10:00:00 GMT" /><script type="text/javascript" src="/socialpm-web/javax.faces.resource/prettify.js.xhtml"></script><script type="text/javascript" src="/socialpm-web/javax.faces.resou
@olivierobert
olivierobert / gist:4066642
Created November 13, 2012 16:07 — forked from DrDurco/gist:1995290
CI: controller
<?php
class Blog extends CI_Controller {
public function __construct()
{
parent::__construct();
// Your own constructor code
}
}
@olivierobert
olivierobert / gist:4066639
Created November 13, 2012 16:07 — forked from etienne-snippet/gist:1993145
CI: Model
<?php
class User_model extends CI_Model {
function __construct()
{
parent::__construct();
}
}