Skip to content

Instantly share code, notes, and snippets.

View supertinou's full-sized avatar

Martin Lagrange supertinou

  • Typeform
  • San Francisco
View GitHub Profile
function getNbs(i,j, board){
let coords = []
for (let ii = i-1; ii<= i+1; ii++){
for (let jj = j-1; jj<= j+1; jj++){
const inbound = ii >= 0 && ii < board.length && jj >= 0 && jj < board[0].length
if (inbound){
coords.push([ii, jj])
}
@supertinou
supertinou / 0_reuse_code.js
Created June 24, 2016 17:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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;
@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 / 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 / 0.sh
Last active September 8, 2015 23:37
Snippets for the Realtime quiz tutorial
git clone [email protected]:supertinou/livequiz.git && cd livequiz && git reset --hard SAMPLE-QUIZ-APP
@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>
@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">

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 = { 
@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 ? ,