Skip to content

Instantly share code, notes, and snippets.

Avatar

Stanislav Panferov s-panferov

View GitHub Profile
@s-panferov
s-panferov / option.ts
Created Nov 30, 2014
Option and Result types from Rust in TypeScript
View option.ts
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>;
@s-panferov
s-panferov / result.ts
Created Nov 19, 2014
Result type in TypeScript
View result.ts
interface Result<T, E> {
map<U>(fn: (a: T) => U): Result<U, E>;
mapErr<U>(fn: (a: E) => U): Result<T, U>;
isOk(): boolean;
isErr(): boolean;
ok(): Option<T>;
err(): Option<E>;
and<U>(res: Result<U,E>): Result<U,E>;
andThen<U>(op: (T) => Result<U,E>): Result<U,E>;
View webpack.config.js
var webpack = require('webpack');
var path = require("path");
module.exports = {
entry: {
app: './src/app/app.ts',
vendor: [
"jquery",
"jquery-mockjax",
View gist:701c89bc101d18b3e929a39457b8bdfe
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.docker.vmnetd</string>
<key>Program</key>
<string>/Library/PrivilegedHelperTools/com.docker.vmnetd</string>
<key>ProgramArguments</key>
<array>
View gist:8423402
package main
import (
"bufio"
"fmt"
"net"
)
func handleConnection(conn net.Conn) {
fmt.Println(conn)
View gist:4690873
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Dawn.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",
"*.pyc",
View react-redux.d.ts
declare module "react-redux" {
import React from "react";
import * as redux from "redux";
interface ProviderProps {
store: redux.Store<any, any>;
}
interface ProviderState {
store: redux.Store<any, any>;
View models-imm.ts
import * as Immutable from 'immutable';
import {
Profile,
User,
} from './models';
export {
Profile,
User,
View app.js
webpackJsonp([0],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports) {