Skip to content

Instantly share code, notes, and snippets.

module Test.Main where
import Prelude
import Control.Monad.Eff.Unsafe (unsafeInterleaveEff)
import Data.Array (reverse)
import Data.Foldable (traverse_)
import Data.Monoid
import Data.Traversable (traverse)
module Test.Main where
import Prelude (Applicative, Apply, Functor, Show, Unit(), (<*>), (<>), (<$>), ($), (<<<), id, bind, map, pure, return, unit)
import Control.Applicative.Free (FreeAp(), NaturalTransformation(), liftFreeAp, foldFreeAp)
import Control.Apply (lift2)
import Control.Monad.Eff (Eff())
import DOM (DOM())
import DOM.Node.Types (Element())
module Forever where
import Prelude
import Control.Monad.Eff
import Control.Monad.Eff.Console
import Control.Monad.Free
import Control.Monad.Rec.Class (forever)
import Data.NaturalTransformation
@ethul
ethul / angular-ui--ui-bootstrap-position.js
Last active August 29, 2015 14:16
Snapshot of the ui.bootstrap.position module from v0.12.1 modified to be loaded as an independent module through npm
var angular = require('angular');
module.exports = angular.module('angular-ui--ui-bootstrap-position', [])
/**
* A set of utility methods that can be use to retrieve position of DOM elements.
* It is meant to be used where we need to absolute-position DOM elements in
* relation to other, existing elements (this is the case for tooltips, popovers,
* typeahead suggestions etc.).
*/
module Main where
import Data.Foreign (Foreign())
import Data.Maybe (Maybe(..))
import Data.Options
import Debug.Trace
data Shape = Circle | Square | Triangle
instance shapeShow :: Show Shape where
// From https://code.google.com/p/gmaps-api-issues/issues/detail?id=3117#c12
function googleMapsFitBoundsAndZoom(google, map, bounds) {
function myFitBounds(myMap, bounds) {
myMap.fitBounds(bounds);
var overlayHelper = new google.maps.OverlayView();
overlayHelper.draw = function () {
if (!this.ready) {
@ethul
ethul / heatmap.js--gmaps-heatmap.js
Last active August 29, 2015 14:07
Snapshot of pa7/heatmap.js gmaps-heatmap.js plugin
/*
* heatmap.js gmaps overlay
*
* Copyright (c) 2014, Patrick Wied (http://www.patrick-wied.at)
* Dual-licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and the Beerware (http://en.wikipedia.org/wiki/Beerware) license.
*/
function newHeatmapOverlay(google, map, cfg) {
@ethul
ethul / angular-ui--bootstrap-position--jqm.js
Created February 4, 2014 18:12
Snapshot of the ui.bootstrap.position module from 2013-11-30
angular.module('ui.bootstrap.position', [])
/**
* A set of utility methods that can be use to retrieve position of DOM elements.
* It is meant to be used where we need to absolute-position DOM elements in
* relation to other, existing elements (this is the case for tooltips, popovers,
* typeahead suggestions etc.).
*/
.factory('$position', ['$document', '$window', function ($document, $window) {
@ethul
ethul / autogrow.js
Last active December 25, 2015 07:38 — forked from thomseddon/gist:4703968
/*
* Adapted from: http://code.google.com/p/gaequery/source/browse/trunk/src/static/scripts/jquery.autogrow-textarea.js
*
* Works nicely with the following styles:
* textarea {
* resize: none;
* word-wrap: break-word;
* transition: 0.05s;
* -moz-transition: 0.05s;
* -webkit-transition: 0.05s;
trait CPList {
type Apply[A]
type :+:[F[_]] <: CPList
type Append[T <: CPList] <: CPList
}
trait NilCP[F[_]] extends CPList {
type Apply[A] = F[A]
type :+:[G[_]] = ConsCP[G,NilCP[F]]
type Append[G <: CPList] = ConsCP[F, G]