Skip to content

Instantly share code, notes, and snippets.

View idkjs's full-sized avatar

Alain Armand idkjs

View GitHub Profile
@idkjs
idkjs / App.js
Created November 14, 2017 18:36 — forked from lpalmes/App.js
React Relay pseudo bindings
import { graphql } from 'react-relay'
const query = graphql`
query AppQuery(id: ID!) {
user(id: $id) {
id
name
}
}`
@idkjs
idkjs / app.js
Created November 15, 2017 12:47 — forked from dwwoelfel/app.js
OneGraph YouTube Demo
const VideoQuery = gql`
query videoPlayerQuery {
ytVideo(id: $videoId) {
id
statistics {
viewCount
likeCount
dislikeCount
}
snippet {
@idkjs
idkjs / README.md
Created November 20, 2017 14:10 — forked from busypeoples/README.md
Making Impossible States Impossible in ReasonML

Making Impossible States Impossible in ReasonML

Introduction

If you have already seen Richard Feldman's talk entitled "Making Impossible States Impossible" or have read "Designing with types: Making illegal states unrepresentable" then you can skip the explanations and just head straight to the Reason examples.

This post is intended to display how to model your Reason Application to prevent creating impossible states. The benefits of being able to design a feature in this way include avoiding having to deal with complex test scenarios regarding defined business rules and a clear documentation of what is possible just by looking at the type definition. Long story short, let's see how this all works by implementing an example.

Requirements

@idkjs
idkjs / glob-up-and-running.md
Created December 1, 2017 10:29 — forked from reggi/glob-up-and-running.md
A tutorial on how to get started using glob patterns in your terminal. #writing

Glob Up and Running

To test a glob pattern go over to globtester and play around with creating your own file structure online, it's super easy to get started that way.

If you want to test out a glob pattern in the terminal use echo followed by the pattern, for instance.

echo **/*.js
open ReasonReact;
open Utils;
type state = {
shown : bool,
value : string
};
let file_dialog = ReasonReact.reducerComponent("InputDialog");
// originaly from https://kb.apify.com/tips-and-tricks/scraping-data-from-websites-using-schemaorg-microdata
function schemaOrgParser() {
var extractValue = function(elem) {
return $(elem).attr("content") || $(elem).text()
|| $(elem).attr("src") || $(elem).attr("href") || null;
};
var addProperty = function(item,propName,value) {
if( typeof(value)==='string' )
value = value.trim();
if( Array.isArray(item[propName]) )
@idkjs
idkjs / refmt.sh
Created February 9, 2019 08:42 — forked from maht0rz/refmt.sh
cd tezos-environment-manager/src/contracts/
refmt --parse re --print ml multisig.re > multisig.liq
@idkjs
idkjs / reason-remote-data.re
Created September 7, 2019 14:13 — forked from busypeoples/reason-remote-data.re
ReasonML port remote-data
/*
remote-data ported to ReasonML
See also https://github.com/krisajenkins/remotedata
Tools for fetching data from remote sources (incl. HTTP).
*/
type remoteData 'e 'a
= NotAsked
| Loading
@idkjs
idkjs / README.md
Created February 25, 2020 16:55
SQLite Points Bot

SQLite-based Points Bot

This is the example code for This Guide. Please read that guide to understand the code provided here.

On the other hand, if you know what you're doing, here's a quick how-to:

  • In an admin command prompt or powershell, run npm i -g --production windows-build-tools.
  • Close all open command prompts for your bot, or the following won't work.
  • npm i discord.js better-sqlite3
  • Create app.js and config.json per below.
  • Make sure to get your bot token in the config.json.
@idkjs
idkjs / sig
Created May 7, 2020 04:11 — forked from yawaramin/sig
Bourne Shell script to print out Merlin's inferred signature of an OCaml file (module)
#!/usr/bin/env sh
# Works with merlin version 2.5.4. Using protocol described at
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking
usage ()
{
echo Usage: either of the following will work:
echo
echo ' sig module.ml'