Skip to content

Instantly share code, notes, and snippets.

@parse
parse / shell.c
Created May 11, 2011 07:31
Simple shell in C
/* Compile with: g++ -Wall –Werror -o shell shell.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
@parse
parse / normalize-denormalize.md
Created January 12, 2017 12:54 — forked from fuyi/normalize-denormalize.md
Model normalize/denormalize flow

Flow

  1. Define nested Schema
  2. Saga middleware detect a _REQUEST Action, which trigger a API request
  3. API request success trigger a _REQUEST_SUCCESS Action, api client get API response, map it with model to be normalized to, if the match found, normalizer flatten the nested JSON objects into flat entities structure, then send to store
  4. Redux store puts the normalized entities in place automatically
  5. ?? We need to manually update associated key to parent object, can this be automated?
  6. When passing data from Store to Container, we denormalize the objects by recursively looking into the key -> object mapping, reassemble the parent object. If any child object is missing, we report a error in console
@parse
parse / circle.yml
Created October 12, 2016 06:15 — forked from dtran320/circle.yml
Yarn on CircleCI
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
override:
- yarn
post: # At least for me, it doesn't seem like `scripts` in `package.json` are being run, so you need to add them explicitly
- yarn run postinstall
@parse
parse / matrixmult.c
Created January 28, 2013 13:18
Simple matrix multiplication
#include <stdio.h>
typedef struct {
int nrows, ncols;
float *data;
} matrix_t;
float constC(int i, int j, matrix_t A, matrix_t B) {
int k;
float res = 0.0;
@parse
parse / gol.erl
Last active February 23, 2016 09:45
Game of Life implementation in Erlang.
-module(gol).
-export([gol/3,timer/1,cell/6]).
% Main program
gol(W,H,Alive) ->
frame:init(),
frame:set_head("Conway's Game of Life in Erlang"),
frame:set_foot("By Jonatan and Anders"),
frame:set_w(W),
frame:set_h(H),
@parse
parse / AppDelegate
Created April 2, 2013 15:25
Remove menu toolbar in keyboard on UIWebView. Credit to photokandyStudios
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
// Register for notification center
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
-- Code created by Kwik - Copyright: kwiksher.com
-- Version: 2.2.5
module(..., package.seeall)
function new()
local numPages = 3
local menuGroup = display.newGroup()
local dispose
local _W = 1536
local _H = 2048
@parse
parse / gist:5094464
Created March 5, 2013 21:30
Fox algorithm output
n = 1000
t = 1
Time: 0.000726, Threads used: 1
Time: 0.000699, Threads used: 1
--
-- Abstract: animated sprite or "movieclip" library
-- This library assembles animation sequences from individual image files. For more advanced
-- texture memory handling, see the "sprite sheet" feature in Corona Game Edition.
--
-- Version: 2.01
--
-- Modified by Michael Hartlef, June 12th, 2010
-- Added setSpeed method, which sets the speed of animation.
@parse
parse / gist:4655433
Created January 28, 2013 13:19
Identify tall iOS devices (e.g. iphone 5) in Corona/Lua
isTall = ( "iPhone" == system.getInfo( "model" ) ) and ( display.pixelHeight > 960 )