Skip to content

Instantly share code, notes, and snippets.

🥊
Clearing lines

Simon Laroche simonlc

🥊
Clearing lines
Block or report user

Report or block simonlc

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
View rand.c
#include <webassembly.h>
struct rng_state {
unsigned int seed;
};
export unsigned short type0_rand(struct rng_state *r) {
unsigned int t;
t = 0x41C64E6DUL * r->seed + 12345;
View 1-users.js
import React from 'react';
import { Link } from 'react-router-dom';
import Table from 'table.js';
function profileUrl(props, item) {
return {
to: `/admin/users/${item.id}`,
};
}
View MapKitAutocomplete.h
#import <React/RCTBridgeModule.h>
#import <MapKit/MapKit.h>
@interface MapKitAutocomplete : NSObject <RCTBridgeModule,MKLocalSearchCompleterDelegate>
@property (strong, nonatomic) MKLocalSearchCompleter *completer;
@end
@simonlc
simonlc / private-methods.js
Created Feb 19, 2017
private fields using closuers
View private-methods.js
function Registry(defaultValue){
const defaultValue = defaultValue;
const values = Object.create(null);
// These functions will always have access to the above variables. Javascript creates
// a closure when functions are created, so the outer scope is available to it.
// These first two functions are public
this.register = function(name, value){
values[name] = value;
};
@simonlc
simonlc / js-sound-example.js
Created Dec 10, 2016
A really quick example on how to use sound buffers.
View js-sound-example.js
'use strict';
// TODO Group audio files so we can control volume seperately
const context = new AudioContext();
const soundDatas = {};
const soundFiles = {
clear: '/audio/clear.wav',
fall: '/audio/fall.wav',
land: '/audio/land.wav',
@simonlc
simonlc / life.js
Created Oct 14, 2012
HTML5 Conway's Game of Life
View life.js
// Conway's Game of Life for HTML5 Canvas
// By Simon Laroche
var FPS = 5;
var paused = true;
var gameStarted = false;
var gLoop;
var generations = 0;
var population = 0;
@simonlc
simonlc / snake.js
Created Oct 13, 2012
HTML5 Snake Game
View snake.js
var FPS = 10;
var gLoop;
var lastX;
var lastY;
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var info = document.getElementById('i');
var wrapper = document.getElementById('w');
var classic = document.getElementById('classic');
@simonlc
simonlc / tictactoe.js
Created Sep 26, 2012
HTML5 Tic-Tac-Toe
View tictactoe.js
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
canvas.addEventListener('click', on_canvas_click, false);
var grid = [['', '', ''], ['', '', ''], ['', '', '']];
var turn = 'X';
var cord_x;
var cord_y;
var reset = false;
You can’t perform that action at this time.