Skip to content

Instantly share code, notes, and snippets.

View ryanlanciaux's full-sized avatar
💭
I may be slow to respond.

Ryan Lanciaux ryanlanciaux

💭
I may be slow to respond.
View GitHub Profile
// This app initially started from Flavio Copes analytics example
// but diverged quite a bit to generate images as well as track views
// https://flaviocopes.com/count-visits-static-site/
const express = require('express')
const app = express()
// no db - so global var to keep track of count
let counter = 0
export default class extends Component {
state = { data: fakeData.slice(0, 10)}
onClick = () => {
this.setState({ data: fakeData.slice(10, 20)})
}
render() {
return (
<div>
@ryanlanciaux
ryanlanciaux / gist:d7fa52911b3b6f87fa03
Created January 11, 2015 22:00
Griddle with Simulated External Data
<div id="griddle-external-simulated"></div>
<script type="text/jsx">
var externalData = fakeData.slice(0, 53);
var SimulatedExternalComponent = React.createClass({
getInitialState: function(){
var initial = { "results": [],
"currentPage": 0,
"maxPages": 0,
var Test =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
var foodApp = angular.module('foodApp', ['ngResource']);
foodApp.factory('Food', ['$resource', function($resource){
return $resource('/food/:id', {id:'@id'}, { update: {method:'PUT' } } );
}]);
foodApp.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/food', {templateUrl: '/templates/list.html', controller: FoodController})
.when('/food/edit/:id', {templateUrl: '/templates/edit.html', controller: FoodController})
@ryanlanciaux
ryanlanciaux / index.ejs
Created June 20, 2013 11:45
Example file from blog post on Angular sorting / filtering.
<h1 id="header">
Food Inventory
</h1>
<div id="content" ng-controller="FoodController">
<div class="filter">
<label for="filter">filter:</label>
<input type="text" name="filter" ng-model="filter" />
</div>
<table>
<thead>
@ryanlanciaux
ryanlanciaux / Food.js
Created June 5, 2013 03:33
Files for AngularJS blog post.
/*---------------------
:: Food
-> model
---------------------*/
module.exports = {
attributes : {
name: 'STRING',
type: 'STRING',
expiration: 'DATE',
quantity: 'STRING',