Skip to content

Instantly share code, notes, and snippets.

View mmaz's full-sized avatar

Mark Mazumder mmaz

View GitHub Profile
@mmaz
mmaz / README.md
Last active April 27, 2016 22:04
Intel Edison startup script
  • add ipaddr.py to /home/root/ and run chmod +x ipaddr.py
  • Add ipaddr.service to /lib/systemd/system (note: lib not etc)
  • test it:
$ systemctl daemon-reload
$ systemctl start ipaddr.service
$ systemctl status ipaddr.service
  • make it run on startup:
@mmaz
mmaz / ReflexMDL.hs
Last active July 22, 2017 18:22
add Google's Material Design Lite to Reflex
import GHCJS.DOM.Types (Element, unElement)
import GHCJS.DOM.Element (toElement)
import GHCJS.Prim (JSRef)
-- http://www.getmdl.io/started/index.html#dynamic
#ifdef __GHCJS__
foreign import javascript unsafe "componentHandler.upgradeElement($1);"
materialInitJS :: JSRef Element -> IO ()
#else
materialInitJS = error "y u no javascript?"
@mmaz
mmaz / README.md
Last active August 29, 2015 14:25
Reflex request example

To start the server

$ ghcjs --make app.hs
$ chmod +x server.hs
$ ./server.hs
$ open "http://localhost:9000/static/index.html"
data WidgetConfig t a
= WidgetConfig { _widgetConfig_setValue :: Event t a
, _widgetConfig_initialValue :: a
, _widgetConfig_attributes :: Dynamic t (Map String String)
}
makeLenses ''WidgetConfig
instance (Reflex t, Default a) => Default (WidgetConfig t a) where
def = WidgetConfig { _widgetConfig_setValue = never
@mmaz
mmaz / Dockerfile
Last active August 29, 2015 14:23 — forked from abn/heredoc-dockerfile.snip
#printf
RUN printf '#!/bin/bash\n\
echo hello world from line 1\n\
echo hello world from line 2\n'\
> /tmp/hello
## or you can use >>
RUN cat /tmp/hello
#echo
@mmaz
mmaz / index.html
Last active August 29, 2015 14:04
CSS isolation in polymer
<!DOCTYPE html>
<html lang="en">
<head>
<title>Polymer CSS test</title>
<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>
<link rel="import" href="test_element.html">
</head>
<body>
<span class="foo">
@mmaz
mmaz / build.sbt
Last active December 19, 2015 22:49
scala Option to Guava Optional
name := "ScalaOptionToGuavaOptional"
scalaVersion := "2.10.2"
libraryDependencies += "com.google.guava" % "guava" % "14.0.1"
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "2.0.1"
@mmaz
mmaz / Instructions.md
Last active February 28, 2016 23:14
Selenium Scala REPL

Selenium Scala REPL

Why Scala?

A REPL is helpful for quick script development with selenium. Scala's REPL offers built-in tab completion and persistent history across sessions. Selenium's javadocs are also more user-friendly than their python counterparts.

Try it out

@mmaz
mmaz / Main.scala
Created June 24, 2013 04:30
Some glue-code to demo using a http://square.github.io/cube/ backend via websockets, with an Evaluator client script in Scala, and an Emitter in Dart.
import java.net.URI
import org.java_websocket.client.WebSocketClient
import org.java_websocket.handshake.ServerHandshake
import spray.json._
class MazClient(serverUri : URI) extends WebSocketClient(serverUri : URI) {
override def onOpen(handshakedata: ServerHandshake) {
println("opened")
}
override def onMessage(message: String) {
@mmaz
mmaz / .emacs
Last active September 26, 2015 05:47
emacs vimrc and tmux configuration
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize) ;;load all the stuff that doesn't automatically get added into the load-path -> this should not be necessary
(require 'evil)
(evil-mode 1)
(require 'powerline)