Skip to content

Instantly share code, notes, and snippets.


Stanislav Panferov s-panferov

View GitHub Profile
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,
View gist:8423402
package main
import (
func handleConnection(conn net.Conn) {
s-panferov / SassMeister-input.scss
Created Aug 8, 2014
Generated by
View SassMeister-input.scss
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
@media mobile {
@media(min-aspect-ratio: 8/5){
width: 18vh;
height: 6vh;
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>;
s-panferov / class_manager.ts
Last active Aug 29, 2015
BEM ClassManager
View class_manager.ts
module classes {
export interface ClassManager {
mod( string[]): ClassManager;
cmod(condition: boolean, string[]): ClassManager;
toString(): string;
before(...other: ToString[]): ClassManager;
after(...other: ToString[]): ClassManager;
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>;
View gist:e9cafbec6ef5d097f041

Hi all, can somebody help me to rewrite this piece of code with new unboxed closures:

struct Builder;
pub fn build(rules: |params: &mut Builder|) -> Builder {
    let mut builder = Builder::new();
    rules(&mut builder);

View gist:476edf52f425a8e12671
var convertSM = require('convert-source-map');
var fs = require('fs');
var rewrite = require('connect-modrewrite');
module.exports = function (grunt) {
grunt.registerTask('tsmap', function() {
var existingMap;
var fileName = process.cwd() + '/dist/app.js';
var fileContent = fs.readFileSync(fileName).toString();
View DOM.ts
var viewClass = bemr.block("card");
return DOM.div({className: viewClass},
DOM.div({className: viewClass.el("cover")},
url: "/public/profile.png",
variant: avatar.Variant.Large,
className: viewClass.el("avatar")
DOM.div({className: viewClass.el("name")},
View API.ts
private dispatchLoadOrgs(action: org_actions.LoadOrgs.Start) {
loadOrgsLock.lock(action.actionId, api.requestManager);
.then((reply) => {
this.dispatcher.dispatch(new org_actions.LoadOrgs.Complete(action, reply.orgs))
.catch((e) => {