Skip to content

Instantly share code, notes, and snippets.

View esshka's full-sized avatar
🏠
Working from home

Eugeny esshka

🏠
Working from home
View GitHub Profile
@esshka
esshka / inheritance.clj
Created February 16, 2016 18:14 — forked from david-mcneil/inheritance.clj
Demonstration of implementation "inheritance" in clojure
;; Define a "base type" of Dog
(defrecord Dog [breed])
;; Define a "sub type" of TrainedDog
(defrecord TrainedDog [dog word])
;; The interface that both Dog and TrainedDog will implement
(defprotocol Talker
(bark [_])
(speak [_])
diff --git a/client/app/bundles/app/startup/ClientApp.jsx b/client/app/bundles/app/startup/ClientApp.jsx
index f8cb40c..0d0cc1e 100644
--- a/client/app/bundles/app/startup/ClientApp.jsx
+++ b/client/app/bundles/app/startup/ClientApp.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import Router from 'react-router';
+import {Router} from 'react-router';
import { browserHistory, hashHistory } from 'react-router';
@esshka
esshka / destructuring.js
Created February 10, 2016 11:50 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring.
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@esshka
esshka / # Sublime Emmet JSX Reactjs.md
Created January 22, 2016 09:52 — forked from max-mykhailenko/# Sublime Emmet JSX Reactjs.md
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
  • Using className instead of class

How it works

  • Install plugin RegReplace
  • Install plugin Chain Of Command

Default Rendering

By default, controllers in Rails automatically render views with names that correspond to valid routes.

For example, if you have this code in your BooksController class:

class BooksController < ApplicationController
end
clamps": [
{
"type": "acl",
"ts": 1421571216000
},
{
"type": "fail",
"ts": 1421589087000
},
{
@esshka
esshka / gist:8bd240695203f7b856bf
Last active September 7, 2015 18:23 — forked from igorpavlov-zz/gist:18af35999f8c7838cf21
AppRTC main JS code
var RTCPeerConnection = null;
var getUserMedia = null;
var attachMediaStream = null;
var reattachMediaStream = null;
var webrtcDetectedBrowser = null;
var webrtcDetectedVersion = null;
function trace(text) {
if (text[text.length - 1] === "\n") {
text = text.substring(0, text.length - 1);
@esshka
esshka / bootstrapping.md
Last active September 7, 2015 16:51 — forked from dideler/bootstrapping.md
Bootstrapping - a list of useful resources to get up and running quickly

Welcome!

For feedback or suggestions, please send a tweet (@dideler). Gist comments don't notify me. Pull requests aren't possible with gists (yet), so I don't recommend forking because then I can't easily get the change.

Starring this gist will give me an idea of how many people consider this list useful.


  • OpenStrategy - kinda like this list, but much nicer presentation
'use strict';
var _ = require('lodash'),
moment = require('moment'),
Promise = require("bluebird");
module.exports = function (clamps) {
let start = +new Date(),
dayms = 1000 * 60 * 60 * 24;
@esshka
esshka / Enhance.js
Last active August 29, 2015 14:26 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {