Skip to content

Instantly share code, notes, and snippets.

View defHLT's full-sized avatar
🐔

Artem Kholodnyi defHLT

🐔
View GitHub Profile
@deebloo
deebloo / rxjs-worker-map.example.js
Last active August 19, 2016 17:24
A RxJs operator that runs in a new thread. https://github.com/deebloo/rxjs-worker
// https://github.com/deebloo/rxjs-worker
var observable = Observable.of([0, 1, 2, 3, 4]);
observable
.map(function (data) {
return data.concat([5, 6, 7, 8, 9]);
})
.workerMap(function (data) {
return data.concat([10,11,12,13,14]);;
})
@okmanideep
okmanideep / BetterRecyclerView.java
Last active March 3, 2022 17:18
A RecyclerView that intercepts the scroll only if the user is scrolling in that direction
public class BetterRecyclerView extends RecyclerView{
private static final int INVALID_POINTER = -1;
private int mScrollPointerId = INVALID_POINTER;
private int mInitialTouchX, mInitialTouchY;
private int mTouchSlop;
public BetterRecyclerView(Context context) {
this(context, null);
}
public BetterRecyclerView(Context context, @Nullable AttributeSet attrs) {
@ghoseb
ghoseb / clj_spec_playground.clj
Last active March 30, 2019 22:35
Examples of Clojure's new clojure.spec library
(ns clj-spec-playground
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.test.check.generators :as gen]))
;;; examples of clojure.spec being used like a gradual/dependently typed system.
(defn make-user
"Create a map of inputs after splitting name."
([name email]
@mkurtikov
mkurtikov / ruby_sintata.rb
Created April 14, 2016 15:47
Sinatra Basics
require 'sinatra'
require 'sinatra/param'
require 'sinatra/json'
set :raise_sinatra_param_exceptions, true
set :show_exceptions, false
get '/hi' do
param :param1, Float, required: true
param :param2, Float, required: true
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@marick
marick / about_those_lava_lamps.md
Last active June 22, 2022 21:08
About Those Lava Lamps

Around 2006-2007, it was a bit of a fashion to hook lava lamps up to the build server. Normally, the green lava lamp would be on, but if the build failed, it would turn off and the red lava lamp would turn on.

By coincidence, I've actually met, about that time, (probably) the first person to hook up a lava lamp to a build server. It was Alberto Savoia, who'd founded a testing tools company (that did some very interesting things around generative testing that have basically never been noticed). Alberto had noticed that people did not react with any urgency when the build broke. They'd check in broken code and go off to something else, only reacting to the breakage they'd caused when some other programmer pulled the change and had problems.

@bostonou
bostonou / promise.cljs
Created July 14, 2015 01:14
Promise.all with core.async
(ns cljs-made-easy.core
(:refer-clojure :exclude [into])
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
(:require [cljs.core.async :refer [<! >!] :as a]))
(enable-console-print!)
(defn resolving-promise [key t reject]
(go
(pr (str key " starting"))
@zchee
zchee / actionlist.vim
Last active April 19, 2024 13:22
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@iPaulPro
iPaulPro / include_list_viewpager.xml
Last active March 7, 2024 11:13
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ 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
@keyboardr
keyboardr / HeadlessFragment.java
Last active December 31, 2021 01:05
A file template for creating a headless Fragment. The attach() methods add the fragment to the parent if it doesn't already exist and returns the attached fragment. The methods ensure that the parent implements the parent interface. If needed, parameters may be added to the attach() methods to supply fragment arguments.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
#parse("File Header.java")
public class ${NAME} extends Fragment {
private static final String FRAG_TAG = ${NAME}.class.getCanonicalName();