Skip to content

Instantly share code, notes, and snippets.

@anttti
anttti / read-file-purify.ts
Last active October 29, 2020 14:12
Reading and parsing a JSON file using Purify
import { EitherAsync } from "purify-ts/EitherAsync";
import { identity } from "purify-ts/Function";
import {
Codec,
string,
number,
date,
boolean,
nullType,
array,
@anttti
anttti / react-file-structure.txt
Created July 26, 2020 10:35
Webbidevaus 90: React-projektin esimerkkitiedostopuu
- src/
--- domain/
----- user/
------- components/
--------- avatar/
----------- index.js
----------- index.css
------- pages/
--------- profile/
----------- index.js
@anttti
anttti / hotdox.json
Last active May 24, 2020 16:39
hotdox.json
{
"version": 1,
"notes": "",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n",
"keyboard": "hotdox",
"keymap": "hotdox_layout_ergodox_mine.json",
"layout": "LAYOUT_ergodox",
"layers": [
[
"KC_ESC",
@anttti
anttti / Nyhtökaurawokki.md
Created November 5, 2019 14:00
Nyhtökaurawokki

Nyhtökaurawokki

AINEKSET

  • 250 g nuudeleita
  • 1 kesäkurpitsa
  • 1 purjo
  • 1 paprika
  • ½ kiinankaali
  • ½ dl öljyä
@anttti
anttti / music-production.md
Created November 25, 2018 08:14
music-production.md
#!/usr/bin/env bash
# Original Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
## Usage: heroku_env_copy [options] SOURCE TARGET
##
## NOTE: This script will only output the command, you should run it yourself.
##
## Options:
## -h, --help Display this message.
##
@anttti
anttti / encode.elm
Created January 19, 2018 19:30
Encode object and array to JSON body for POSTing in Elm
getWeeklyReports : Cmd Msg
getWeeklyReports =
let
url =
"http://localhost:3001/engagement"
body =
Http.jsonBody <|
Encode.object
[ ( "groupNames", Encode.string "Tammerforce" )
@anttti
anttti / vr.js
Created January 9, 2018 08:48
VR No Flash bookmarklet
javascript:(function(d){var%20s=d.createElement('script');s.src='https://vr.aarre.net/nf.min.js?D='+(new%20Date()).getTime();d.head.appendChild(s)})(document)
@anttti
anttti / share.js
Created March 1, 2017 11:53
Facebook & Twitter -sharing without SDKs
onShareFB() {
window.open(
'https://www.facebook.com/sharer/sharer.php?u=http://SHARE-URL.com',
'pop',
'width=600, height=400, scrollbars=no'
);
},
onShareTwitter() {
window.open(
'https://twitter.com/intent/tweet?text=http://SHARE-URL.com',
@anttti
anttti / looby-bot-3.js
Created February 16, 2017 07:52
looby-bot-3.js
const TelegramBot = require('node-telegram-bot-api');
const express = require('express');
const packageInfo = require('./package.json');
const token = 'token-goes-here';
const telegram = new TelegramBot(token, { polling: true });
telegram.on('message', (message) => {
console.log(message);
telegram.sendMessage(message.chat.id, 'Received your message');