Skip to content

Instantly share code, notes, and snippets.

View ikr's full-sized avatar

Ivan Krechetov ikr

View GitHub Profile
@rossharper
rossharper / ParameterizedKotlinTest.kt
Created February 20, 2016 21:51
Parameterized JUnit4 test example in Kotlin
@RunWith(Parameterized::class)
class KotlinTest(val paramOne: Int, val paramTwo: String) {
companion object {
@JvmStatic
@Parameterized.Parameters
fun data() : Collection<Array<Any>> {
return listOf(
arrayOf(1, "I"), // First test: (paramOne = 1, paramTwo = "I")
arrayOf(1999, "MCMXCIX") // Second test: (paramOne = 1999, paramTwo = "MCMXCIX")
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@ikr
ikr / .eslintrc.yaml
Last active August 29, 2015 14:22
My ESLint config for React/ES6/JSX code
env:
browser: true
mocha: true
es6: true
plugins:
- react
ecmaFeatures:
modules: true
@paulkoegel
paulkoegel / The Functional Final Frontier - (David Nolen.ClojureWest.2014-03).markdown
Last active July 6, 2017 06:11
The Functional Final Frontier - David Nolen at Clojure/West 2014

The Functional Final Frontier - David Nolen at Clojure/West 2014

(still incomplete, covers only the first 16 minutes)

Video

  • Functional programming and programming with values have proven their usefulness when building all kinds of systems, but they've been hard to apply when building user interfaces.

  • Object-oriented programming and user interfaces came up at around the same time and went hand in hand ever since. First user interfaces were, e.g., written in Smalltalk (created in 1972 by Alan Kay). This led to the development of the Model-View-Controller paradigm.

@igorw
igorw / quine.php
Created October 17, 2013 21:48
Quine, from Tom Stuart's "Understanding Computation".
<?php
$data = <<<'DATA'
$program = <<<PROGRAM
<?php
\$data = <<<'DATA'\n$data\nDATA;
$data
PROGRAM;
echo $program;
DATA;
@ikr
ikr / jshintrc.json
Created July 5, 2013 14:23
Pure JSON version of my .jsonrc -- https://gist.github.com/ikr/5676468
{
"bitwise" : true,
"curly" : true,
"eqeqeq" : true,
"forin" : true,
"immed" : true,
"latedef" : true,
"newcap" : true,
"noarg" : true,
"noempty" : true,
@asm89
asm89 / gist:5797852
Last active December 18, 2015 14:29
Rerun PHPUnit on file changes in a given dir (defined in my .bashrc)
# watch files and rerun phpunit on changes
phpunitwait() {
while inotifywait $(find $1 -name '*.php');
do
clear;
phpunit --colors $2;
done;
}
@ikr
ikr / index.php
Last active December 18, 2015 03:58
Hide a xiag (dev) domain from Google
<?php
$app->get('/robots.txt', function () {
return new Response(
(
(stripos($_SERVER['HTTP_HOST'], 'xiag') !== false) ?
"User-agent: *\nDisallow: /\n" :
"User-agent: *\n"
),
@ikr
ikr / .jshintrc
Last active December 17, 2015 21:39
.jshintrc http://www.jshint.com/docs/#options -- ikr's edition
{
// ================================== //
// Yes, VERY srtrict. THIS IS SPARTA! //
// ================================== //
// == Enforcing Options ===============================================
//
// These options tell JSHint to be more strict towards your code. Use
// them if you want to allow only a safe subset of JavaScript, very
// useful when your codebase is shared with a big number of developers
@ikr
ikr / couchModuleText.js
Last active December 16, 2015 15:49
Test-drive a self-contained node module (viewUtils.js here), and then use it as a CouchDB CommonJS module. Sample schema installation and update scripts included.
(function (undefined) {
"use strict";
var _ = require("underscore");
module.exports = function (nodeModule, dependencyNameToPathMap) {
return _.map(dependencyNameToPathMap, function (path, name) {
return ["var ", name, " = require(\"", path, "\");"].join("");
}).concat(
_.isFunction(nodeModule) ?