Skip to content

Instantly share code, notes, and snippets.

View ashishsc's full-sized avatar

Ashish Chandwani ashishsc

View GitHub Profile
@PixelPartner
PixelPartner / USDZ_AR_QuickLook_with_elm-ui.elm
Created October 17, 2018 16:50
Define your own elm-ui Element that works with Safari AR Quicklook feature on iOS 12+
{-
Define your own elm-ui Element that works with Safari AR Quicklook feature on iOS 12+
The problem with the standard Element nodes is that Safari wants the <a> node to only have
a single child and that needs to be an <img>
-}
usdz : List (Attribute Msg) -> { usdzUrl : String, imgUrl : String } -> Element Msg
usdz attrs rec =
link
( htmlAttribute (Html.Attributes.attribute "rel" "ar")
@pdamoc
pdamoc / Mario.elm
Created May 8, 2016 20:00
Mario 0.17
import Html exposing (..)
import Keyboard
import Window exposing (Size)
import AnimationFrame
import Task
import Html.App as App
import Collage exposing (..)
import Element exposing (..)
@paulirish
paulirish / what-forces-layout.md
Last active April 26, 2024 17:33
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
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

@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
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
<?php
/**
* Sync Groups from WordPress to Discourse
*
* First creates 'groups' meta_key (which should be customized to your needs)
* Then it monitors for changes in the 'groups' meta_value and connects to Discourse API to sync groups
*
* WordPress References
* https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/meta.php?order=name#L235
* http://wordpress.stackexchange.com/questions/16835/how-to-hook-update-post-meta-and-delete-post-meta