Skip to content

Instantly share code, notes, and snippets.

View martimatix's full-sized avatar

Mario Martinez martimatix

View GitHub Profile
@martimatix
martimatix / query.graphql
Last active December 27, 2017 04:22
Github Graphql Query
query {
user (login: "martimatix") {
name
repositories (first: 5, orderBy: { field: UPDATED_AT, direction: DESC }) {
pageInfo {
hasNextPage
endCursor
}
edges {
node {
@martimatix
martimatix / main.elm
Created March 1, 2017 06:46
URL Change Reactor
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
UrlChange location ->
let
( nextPhrase, nextPhrases ) =
nextLineAndCycleList model.phrases
in
{ model
| location = location
@martimatix
martimatix / main.elm
Last active March 1, 2017 06:42
Location Bar Message
Tick time ->
if time |> inSeconds |> isMultipleOfThree then
let
( nextLine, nextModel ) =
nextLineAndCycleList model
in
nextModel ! [ Navigation.modifyUrl nextLine ]
else
model ! []
@martimatix
martimatix / as_model.elm
Created October 30, 2016 22:55
Handly Elm
-- DungeonGenerator.elm
clean : Model -> Model
clean ({ rooms, corridors, activePoints } as model) =
@martimatix
martimatix / index.js
Last active May 21, 2022 18:38
Writing data to Dynamodb from Serverless
'use strict';
const doc = require('dynamodb-doc');
const dynamo = new doc.DynamoDB();
const Q = require('kew');
module.exports.handler = (event, context, callback) => {
function putItem() {
const defer = Q.defer();
@martimatix
martimatix / index.html
Last active October 9, 2016 03:31
Initialisation code for crystal-elm-chat
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Elm Crystal Chat Proof of Concept</title>
<script src="elm.js"></script>
</head>
<body>
<script type="text/javascript">
const websocketProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import WebSocket
import List
main: Program Never
main =
Html.program
@martimatix
martimatix / Main-v1.elm
Created June 26, 2016 07:12
movie_poster_finder
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
@martimatix
martimatix / clock.elm
Last active August 16, 2021 09:25
Elm Subscription Example - Pause and Resume the clock
import Html exposing (Html, p, label, br, input)
import Html.App as Html
import Html.Attributes exposing (checked)
import Html.Events exposing (onCheck)
import Svg exposing (..)
import Svg.Attributes exposing (..)
import Time exposing (Time, second)
main =
[
{
"category": {
"iconPath": null,
"id": 4,
"keywords": [
"Learning",
"Education"
],
"name": "Education Centres"