Skip to content

Instantly share code, notes, and snippets.

View martimatix's full-sized avatar

Mario Martinez martimatix

View GitHub Profile
@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 / 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 =
@martimatix
martimatix / .vimrc
Last active May 6, 2020 14:43
.vimrc
syntax on
set hidden
set noerrorbells
set tabstop=2 softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
set nu
set nowrap
@martimatix
martimatix / Elm_Syd_May_2019.md
Last active March 24, 2020 10:52
Elm Presentation - Compiler Error Messages

Elm Syd May 2019


News


@martimatix
martimatix / updated_at.sql
Created March 25, 2019 12:01
Hasura Gists
-- This will automatically update the `updated_at` column on the table `category`
CREATE OR REPLACE FUNCTION update_modified_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = now();
RETURN NEW;
END;
$$ language 'plpgsql';
@martimatix
martimatix / cargo.toml
Last active March 16, 2019 11:22
Rust SIG
[package]
name = "webservice"
version = "0.1.0"
authors = ["Mario Martinez <zenitram.oiram@gmail.com>"]
edition = "2018"
[dependencies]
rocket = "0.4.0"
perfect_numbers = { path = "../perfect-numbers" }
@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
@martimatix
martimatix / Main.elm
Last active August 2, 2018 21:46
Optional arguments with 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, img)
import Html.Attributes exposing (src)
import RemoteData exposing (RemoteData)
import Github.Object
import Github.Object.User as User
@martimatix
martimatix / atom.cson
Created June 4, 2018 11:12
atom shortcuts
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#!/bin/bash
echo "determining branch"
branch=`git branch | sed -e s/^\.\ // | grep $1`
echo "checking out $branch"
git checkout $branch