Skip to content

Instantly share code, notes, and snippets.

const t = require("tcomb");
// imstruct is a tcomb type builder that internally builds an
// Immutable.Record object, but applies tcomb's type system to it
const imstruct = require("../util/imstruct");
const Person = imstruct({
name: t.String,
age: t.Number
});
@ealize
ealize / config.fish-non-interactive
Created March 4, 2016 06:25
Fish shell non-interactive/non-login mode
# Prevent Fish shell from generating strings when in non-interactive mode (e.g. while using SCP)
# Add this to the top of your config.fish file
if not status --is-login or not status --is-interactive
exit
end
@pezza3434
pezza3434 / gist:ac5db3fd5a3b6bc985e4
Last active March 21, 2016 14:16
Submission to speak at reactive2015

##Moving from Angular to React

For over a year I had been helping to create a production app with Angular. I was initially hugely impressed by the advantages Angular offered and invested a lot of time learning the intricacies of the framework.

Having being initially cautious about React as one of the many upcoming frameworks that wouldn't stick around I was hesitant to make the switch. However, after making the jump I've been using React for a few months now and been thouroughly impressed.

This will be a short talking explaining:

  • The shift in thinking when moving from Angular to React
  • The difficulties when moving from Angular to React
  • What we can learn from Angular and how having a previous knowledge of other frameworks can help significantly when creating React apps.
@kpuputti
kpuputti / fold.js
Last active May 26, 2021 18:18
Functional acrobatics using folds in JavaScript.
/*eslint-env es6 */
// Inspired by the paper "A tutorial on the universality and
// expressiveness of fold" by Graham Hutton (available at
// http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic
// list handling functions in JavaScript in terms of `fold`.
// Personally I had an enlightnening moment when I realised the
// beautiful interplay of cons lists and foldr during the FP101x
// Haskell course. JavaScript's syntax doesn't make this very apparent
@s-panferov
s-panferov / option.ts
Created November 30, 2014 12:15
Option and Result types from Rust in TypeScript
interface Option<T> {
map <U>(fn: (a: T) => U): Option<U>;
isSome(): boolean;
isNone(): boolean;
isSomeAnd(fn: (a: T) => boolean): boolean;
isNoneAnd(fn: () => boolean): boolean;
unwrap(): T;
unwrapOr(def: T): T;
unwrapOrElse(f: () => T): T;
map<U>(f: (a: T) => U): Option<U>;

Anivia

Anivia is Walmart's mobile analytics platform. It collects user-interaction metrics from mobile devices -- iPhone, iPad, Android, and mWeb. It also processes logging and other metrics from a bunch of mobile services. Anivia allows the business to have real-time insight and reporting into what is going on in the mobile business and provides vital capabilities for developers and ops folks to monitor the health of their services.

Anivia is built on Node.js, Hapi, RabbitMQ, and a multitude of downstream systems including Splunk and Omniture. Anivia is taking in 7,000 events per second on average (as of this writing), which after some fan-out and demuxing comes out to around 20,000 messages per second in flight. These rates are expected to soar leading up to and including Black Friday. The platform has grown in recent months to over 1,000 node processes spanning multiple data centers, gaining features such as link resiliency in the process.

A few of Anivia's functionalities

  • __Timestamp Correc
@kpdecker
kpdecker / nodebf.md
Last active June 2, 2016 18:02
mobile.walmart.com #nodebf 2014

Mobile Server Side Rendering

This year marks the first year that we are doing full scale rendering of our SPA application on our mobile.walmart.com Node.js tier, which has provided a number of challenges that are very different from the mostly IO-bound load of our prior #nodebf.

The infrastructure outlined for last year is the same but our Home, Item and a few other pages are prerendered on the server using fruit-loops and hula-hoop to execute an optimized version of our client-side JavaScript and provide a SEO and first-load friendly version of the site.

To support the additional CPU load concerns as peak, which we hope will be unfounded or mitigated by our work, we have also taken a variety of steps to increase cache lifetimes of the pages that are being served in this manner. In order of their impact:

Event Loop Management

@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@agendor
agendor / hapijs-rest-api-tutorial.md
Last active August 31, 2021 08:31
A practical introduction to building a RESTful API with the hapi.js server framework for Node.js
@JamesDullaghan
JamesDullaghan / digitalocean.md
Created July 6, 2013 20:54
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email