Skip to content

Instantly share code, notes, and snippets.

View martimatix's full-sized avatar

Mario Martinez martimatix

View GitHub Profile
@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:';
@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 / as_model.elm
Created October 30, 2016 22:55
Handly Elm
-- DungeonGenerator.elm
clean : Model -> Model
clean ({ rooms, corridors, activePoints } as model) =
@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 / 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 / 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 / fauna_prototype_v1.cr
Last active March 18, 2018 01:59
Fauna DB syntax prototype
# This backwards approach wouldn't work because things like `let` and `do` would seem unnatural.
Fauna
.index('all_things_random_and_ref')
.match
.paginate(size: size, after: after)
.select('data')
.map { |_, ref| ref.get }
.query
# Path to your oh-my-zsh installation.
export ZSH=/Users/martimatix/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
plugins=(git)
@martimatix
martimatix / Main.elm
Last active November 23, 2018 08:35
A beginner's guide to Graphqelm
module Main exposing (main)
import Graphqelm.Operation exposing (RootQuery)
import Graphqelm.Http
import Graphqelm.SelectionSet exposing (SelectionSet, with)
import Html exposing (Html, a, div, h1, h2, p, pre, text)
import RemoteData exposing (RemoteData)
import Github.Object
import Github.Object.User as User
import Github.Query as Query
#!/bin/bash
echo "determining branch"
branch=`git branch | sed -e s/^\.\ // | grep $1`
echo "checking out $branch"
git checkout $branch