Skip to content

Instantly share code, notes, and snippets.

View ivanbanov's full-sized avatar
:octocat:
undefined

Ivan Banov ivanbanov

:octocat:
undefined
View GitHub Profile
@pbroschwitz
pbroschwitz / supplant.js
Created October 15, 2012 07:58
supplant - Crockford
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@DavidWells
DavidWells / reset.css
Last active July 27, 2024 15:56 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips: https://twitter.com/davidwells
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@jshbrntt
jshbrntt / gulpfile.js
Created July 13, 2015 08:44
Browserify + Watchify + Browser Sync + Bower
/* global require */
var _ = require('lodash');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var buffer = require('vinyl-buffer');
var del = require('del');
var gulp = require('gulp');
var gutil = require('gulp-util');
var minify = require('gulp-minify-css');
@Falconerd
Falconerd / gulpfile.js
Last active April 10, 2019 17:16
Gulp + Watchify + Babelify + BrowserSync
/**
* This gulpfile will copy static libraries and a index.html file as well as
* merge, babelify and uglify the rest of the javascript project.
*
* TODO:
* - Separate media, libs and src with different watchers.
* - Media and libs should only be copied to dist if they are different sizes.
*
* The expected project is to be laid out as such:
*
module Json.Decode.Generic where
import Json.Decode as Decode exposing (Decoder, (:=))
import Array exposing (Array)
import Dict exposing (Dict)
type JsonValue = JsonNull
| JsonBool Bool
| JsonString String
| JsonFloat Float

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
module Child exposing (init, update, Message(InterestingMessage))
init = 0
type Message
= InterestingMessage
| InternalMessage
update message model = model
@sabine
sabine / Templates.elm
Last active December 12, 2017 19:10
SVG spritesheet builder snippet (using svgstore + SVGO) for use with Elm
import Svg
import Svg.Attributes as SvgA
import SVGSprites
icon : Types.Taco -> (SVGSprites.Sprites -> String) -> List (Svg.Attribute msg) -> Html msg
icon taco name attrs =
Svg.svg
attrs
[ Svg.use [ SvgA.xlinkHref (taco.staticUrl ++ "icons/sprites.svg#" ++ (name SVGSprites.sprites)) ] []
]
@canhnt
canhnt / git-delete-local-tag.sh
Created August 9, 2017 09:11
Delete local tags that do not exist in remote
git fetch --prune origin "+refs/tags/*:refs/tags/*"