Skip to content

Instantly share code, notes, and snippets.

Mark Bolusmjak z5h

Block or report user

Report or block z5h

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ListSet.elm
module Base.ListSet exposing
( Set
, diff
, empty
, filter
, foldl
, foldr
, fromList
, group
, insert
@z5h
z5h / Example.elm
Last active Dec 20, 2018
autofocus in Elm that actually works
View Example.elm
input [
focus (item.id) (RequiresFocus_ Nothing)
else
none
]
View Main.elm
import Stopwatch
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
main: Program Never
main =
App.program
{ init = init
View TimeApp.elm
module TimeApp ( start, Config, App ) where
{-| This module helps you start your application in a typical Elm workflow.
It assumes you are following [the Elm Architecture][arch] and using
[elm-effects][]. From there it will wire everything up for you!
**Be sure to [read the Elm Architecture tutorial][arch] to learn how this all
works!**
[arch]: https://github.com/evancz/elm-architecture-tutorial
[elm-effects]: http://package.elm-lang.org/packages/evancz/elm-effects/latest
@z5h
z5h / Swap.elm
Created Jul 24, 2015
Elm rendering focus loss
View Swap.elm
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type Action
= NoOp
| EditEntry Entry String
type alias Entry =
View keybase.md

Keybase proof

I hereby claim:

  • I am z5h on github.
  • I am bolusmjak (https://keybase.io/bolusmjak) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@z5h
z5h / update.js
Last active Aug 29, 2015
Get the result of updating a Javascript object while treating it as immutable.
View update.js
/**
* Get the result of updating `obj` with `props`, while treating `obj`
* as immutable.
*/
var update = function(obj, props){
var keys = Object.keys(props),
key,
changed = false,
i;
@z5h
z5h / StickierDiv.jsx
Last active Nov 17, 2016
sticky header div react js
View StickierDiv.jsx
/** @jsx React.DOM */
"use strict";
var util = {
// findPos() by quirksmode.org
// Finds the absolute position of an element on a page
findPos: function (obj) {
var curleft = 0,
curtop = 0;
@z5h
z5h / join-on
Last active Aug 29, 2015
does a join on 2 files based on 1st capture of regex. e.g.: join-on Gemfile "gem '([^']*)'" Gemfile.lock " *([^ ]*)"
View join-on
#!/usr/bin/env ruby
# example use: join-on Gemfile "gem '([^']*)'" Gemfile.lock " *([^ ]*)"
file1, cap1, file2, cap2 = *ARGV
r1 = Regexp.new(cap1)
r2 = Regexp.new(cap2)
line_match_number = []
n = 0
max_len = 0
File.open(file1).each do |line|
You can’t perform that action at this time.