Skip to content

Instantly share code, notes, and snippets.

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

Zhomart Mukhamejanov Zhomart

🏠
Working from home
View GitHub Profile
# app/models/concerns/history_field_concern.rb
module HistoryFieldConcern
extend ActiveSupport::Concern
# consider using "before_save" and Changable
# https://github.com/mongodb/mongoid/blob/master/lib/mongoid/changeable.rb
included do
end
package main
import (
"bufio"
"fmt"
"os"
)
func Reverse(a []byte) {
n := len(a)
@Zhomart
Zhomart / introrx.md
Last active September 9, 2015 07:32 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@Zhomart
Zhomart / capybara cheat sheet
Last active August 29, 2015 14:27 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
76.2
68.4
67.2
64.4
60.8
59.8
59.6
56.6
54.6
53.4
@Zhomart
Zhomart / l2_firewall_STUDENT_ID.py
Created July 27, 2015 08:57
Template Firewall SDN Controller.
# Copyright 2011-2012 James McCauley
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk
export LOCAL_SBIN="/usr/local/sbin"
export WORDNET_BIN="/usr/local/WordNet-3.0/bin"
export HEROKU_BIN="/usr/local/heroku/bin"
export PATH="$HOME/bin:/usr/local/bin:$PATH:$HEROKU_BIN:$LOCAL_SBIN:$WORDNET_BIN"
export PATH="$PATH:/Applications/Android Studio.app/sdk/platform-tools"
export PATH="$PATH:/Users/zhomart/Downloads/tree-tagger-MacOSX-3.2-intel/cmd"
export PATH=$PATH:/Users/zhomart/Applications/activator-1.2.12-minimal
@Zhomart
Zhomart / gunicorn.stderr.log
Created February 25, 2015 06:33
"tail logs/gunicorn.stderr.log"
Trying import local.py settings...
Monkey patching...
Trying import local.py settings...
Monkey patching...
WARNING Property: Unknown Property name. [6:51: -webkit-text-size-adjust]
WARNING Property: Unknown Property name. [6:82: -ms-text-size-adjust]
WARNING Property: Unknown Property name. [7:23: mso-table-lspace]
WARNING Property: Unknown Property name. [7:45: mso-table-rspace]
WARNING Property: Unknown Property name. [8:17: -ms-interpolation-mode]
ERROR Property: Invalid value for "CSS Level 2.1" property: 0.8rem 3rem [173:17: padding]
@Zhomart
Zhomart / taiga-sign-up-email
Created February 25, 2015 06:30
Subject: You've been Taigatized!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>You have been Taigatized</title>
<style type="text/css">.bodyContent a:link {color:#699b05;font-weight:normal;text-decoration:underline}
..bodyContent a:visited {color:#699b05;font-weight:normal;text-decoration:underline}
..bodyContent a.button:hover {background:#aad400}
..social-links a:link {color:#699b05;font-weight:normal;text-decoration:underline;text-align:center;margin:0 5px}
..social-links a:visited {color:#699b05;font-weight:normal;text-decoration:underline;text-align:center;margin:0 5px}