Skip to content

Instantly share code, notes, and snippets.

View ascii chess board.txt
♜♞♝♛♚♝♞♜
♟♟♟♟♟♟♟♟
□■□■□■□■
■□■□■□■□
□■□■□■□■
■□■□■□■□
♙♙♙♙♙♙♙♙
♖♘♗♕♔♗♘♖
@jehoshua02
jehoshua02 / randomItem.elm
Last active Sep 30, 2016
Here's how I would have liked to get a random number in elm
View randomItem.elm
randomItem : List a -> Maybe a
randomItem xs =
case xs of
[] ->
Nothing
_ ->
let
randomInt =
Random.int 0 ((List.length xs) - 1)
View PR_Template_Bookmark.md

PR Template Bookmark

javascript:(function pullRequestTemplate() {
  var e = document.activeElement;
  if (e) {
    e.value += [
      '#### What does this PR do?',
      '#### Where should the reviewer start?',
      '#### How should this be manually tested?',
@jehoshua02
jehoshua02 / JsonFileDataProviderIterator.php
Last active Jun 15, 2018
JsonFileDataProviderIterator class for use with PHPUnit @dataProvider annotation.
View JsonFileDataProviderIterator.php
<?php
class JsonDataProviderIterator implements Iterator
{
protected $position = 0;
protected $array;
public function __construct($test, $namespace)
{
$path = preg_replace('/.php$/', '.data', $test) . '/' . $namespace;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
console.log('hello');
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
View bem_renaming_example.json
{
".modal" : ".modal",
".modal.modal-open" : ".modal--open",
".modal > .inner" : ".modal__inner",
".modal > .inner > .head" : ".modal__head",
".modal > .inner > .head > .title" : ".modal__title",
".modal > .inner > .head > .modal-toggle": ".modal__head > .modal-toggle",
".modal > .inner > .body" : ".modal__body",
".modal > .inner > .foot" : ".modal__foot"
}
@jehoshua02
jehoshua02 / className.js
Created May 4, 2015
React.addons.classSet() replacement ...
View className.js
module.exports = function (classSet) {
return Object.keys(classSet).filter(function (className) {
return !!classSet[className];
}).join(' ');
};
@jehoshua02
jehoshua02 / debounce.js
Created May 1, 2015
Primitive debounce function.
View debounce.js
var debounce = (function () {
var timeouts = {};
return function (id, callback) {
if (timeouts[id]) {
clearTimeout(timeouts[id]);
}
timeouts[id] = setTimeout(callback, 300);
}
})();
@jehoshua02
jehoshua02 / reflux_is_simple.md
Created Apr 7, 2015
Simple breakdown of how Reflux works.
View reflux_is_simple.md