Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View supertinou's full-sized avatar

Martin Lagrange supertinou

  • Typeform
  • San Francisco
View GitHub Profile

RAILS_RELATIVE_URL_ROOT

Rails

By default RAILS_RELATIVE_URL_ROOT is used only for asset pipeline.

To namespace your rails routes you need to wrap run MyApp::Application with map in your config.ru:

map ENV['RAILS_RELATIVE_URL_ROOT'] || "/" do
@supertinou
supertinou / Readme.md
Last active June 12, 2018 11:53
React component which displays participants statuses and refresh the statuses in Realtime.

Component

Usage

You can display / refresh / add participants by passing to the participants property an array of participants. See the examples below:

Displaying some participants:

participants = [
@supertinou
supertinou / QuestionDisplay React component.md
Last active November 7, 2015 22:05
React component for displaying and answering questions

Component

Usage

You can display a question by passing to the questions property a representing a question See the example below:

Displaying a question:

question = { question: { title: What is the color of the sky ? ,

feed

Usage

You can add an activity to the ActivityFeed component by passing to the newActivity property a hash representing the activity See the example below:

Displaying a question:

 activity = { 
@SuccessNotifier = React.createClass
render: ->
[image, text] = if this.props.success
['/images/correct.png','Well done !']
else
['/images/wrong.png', 'Wrong answer !']
<div className="list-group-item">
<div className="row">
<div className="col-md-2">
@ResultsDisplay = React.createClass
render: ->
<div className="list-group-item">
<div className="row">
<div className="col-md-2">
<img className='media-object' src="/images/graduated.png" />
</div>
<div className="col-md-9">
<h1>The quiz session is finished</h1>
<h3>Here are the results:</h3>
@supertinou
supertinou / 0.sh
Last active September 8, 2015 23:37
Snippets for the Realtime quiz tutorial
git clone git@github.com:supertinou/livequiz.git && cd livequiz && git reset --hard SAMPLE-QUIZ-APP
@supertinou
supertinou / animated-gif.md
Created February 25, 2016 07:27 — forked from stephenlb/animated-gif.md
DIY How to make your own HD Animated GIF Generator

HD Animated GIF Generator

You can make your own HD animated GIF generator.
Follow along with these commands to get started.

HD Animated GIF Generator

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
@supertinou
supertinou / config.js
Created April 22, 2016 21:45
AngularJS : Capture and console log all broadcasts
.config(function($provide) {
$provide.decorator("$rootScope", function($delegate) {
var Scope = $delegate.constructor;
var origBroadcast = Scope.prototype.$broadcast;
var origEmit = Scope.prototype.$emit;
Scope.prototype.$broadcast = function($scope) {
console.log("$broadcast was called on $scope " + $scope.$id + " with arguments:",
arguments);
return origBroadcast.apply(this, arguments);
@supertinou
supertinou / repeat-complete.directive.js
Created June 16, 2016 18:29
An AngularJS directive that allows to be aware when a ng-repeat has finish being rendered.
// @author: @BenNadel
// Source : http://www.bennadel.com/blog/2592-hooking-into-the-complete-event-of-an-ngrepeat-loop-in-angularjs.htm
angular.module('app')
.directive("repeatComplete",
function( $rootScope ) {
// Because we can have multiple ng-repeat directives in
// the same container, we need a way to differentiate
// the different sets of elements. We'll add a unique ID
// to each set.
var uuid = 0;