Skip to content

Instantly share code, notes, and snippets.

View kwrooijen's full-sized avatar

Kevin van Rooijen kwrooijen

View GitHub Profile
@idleberg
idleberg / DropboxIgnore.md
Last active June 4, 2023 12:02
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@ane
ane / repl.rs
Created November 17, 2015 17:26
Guile REPL in Rust
use std::ffi::CString;
use std::env;
use std::ptr;
use libc::{c_char, c_void, c_int};
#[link(name="guile-2.0")]
extern {
fn scm_shell(argc: c_int, argv: *const *const c_char) -> c_void;
fn scm_boot_guile(argc: c_int,
argv: *const *const c_char,
@teamon
teamon / avatar.ex
Created September 9, 2016 21:30
Quickly create avatar image from user name (initials)
# Much simplified version based on https://github.com/zhangsoledad/alchemic_avatar
# Avatar.generate/2 returns a Plug.Upload that can be passed directly
# into Ecto.Changeset (as for example fallback image)
defmodule Avatar do
@defaults [
size: 300,
font_path: Application.app_dir(:my_app, "priv/fonts/Roboto.ttf"),
font_size: 40,
font_weight: 500,
@WietseWind
WietseWind / sample.ubl.xml
Created September 19, 2016 09:00
UBL Template XML
<?xml version="1.0" encoding="UTF-8"?>
<nl-inv:Invoice xsi:schemaLocation="http://www.nltaxonomie.nl/ubl/2.0/NL/1.0/xsd/maindoc/UBL-NL-Invoice ../xsd/maindoc/UBL-NL-Invoice-1.0.xsd" xmlns:nl-inv="http://www.nltaxonomie.nl/ubl/2.0/NL/1.0/xsd/maindoc/UBL-NL-Invoice" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cbc:UBLVersionID>2.0</cbc:UBLVersionID>
<cbc:CustomizationID>1.0</cbc:CustomizationID>
<cbc:ProfileID>NL</cbc:ProfileID>
<cbc:ID>{{ invoiceNumber }}</cbc:ID>
<cbc:CopyIndicator>false</cbc:CopyIndicator>
<cbc:IssueDate>{{ invoiceDate }}</cbc:IssueDate>
<cbc:InvoiceTypeCode listAgencyID="88" listAgencyName="Logius Gegevensbeheer NL-Overheid" listID="NL-1001" listName="FactuurSoort" listSchemeURI="http://www.nltaxonomie.nl/ubl/2.0/NL/1.0/cl/gc/NL-InvoiceCode" listURI="http://www.nltaxonomie.nl/ubl/2.0/NL/1.

Upload component

Context

Based heavily on [s3-beam][1], but uses re-frame events/subs to get the job done. The /sign handler is the [s3-beam][1] handler (near verbatim).

For background on (ui.core/component "...") see https://opensourcery.co.za/2017/02/12/using-semantic-ui-react-with-re-frame/

ui.ajax is just thin wrappers and/or aliases around plumbing from ajax.core from cljs-http

@jamesnyika
jamesnyika / React Navigation V3+ in Clojurescript.md
Last active November 16, 2020 14:10
React Navigation V3+ in Clojurescript

React Navigation is a great component for building mobile applications. It is versatile and supports both dominant platforms beautifully. However, despite the 2 libraries that exist out there to support this component in the Clojure ecosystem, there is sadly very little documentation on what and how you can set up and use this component. I could not get them to work for me (my failing) so I decided to try and make it work without the existing libraries just to that I can understand what is going on. Below is a laying out of my experience. Let me know if you have corrections so that we mortals who are not that sharp can learn.

React Navigation requires an exact set of steps to make it successfully work

Step 1: Installation of React Navigation

Use yarn to add the library to the project

@mhuebert
mhuebert / Readme.md
Last active March 1, 2024 16:55
material-ui's CSS-in-JS with Reagent. (see https://material-ui.com/customization/css-in-js/)

material-ui allows for customizing CSS via a higher-order component called withStyles. Like many higher-order components which expect render props, the purpose of withStyles is to accept some parameters, and then introduce a new variable into the scope of the component tree.

One succinct and simple way to translate the concept of scope into Clojure is via a custom let macro. Usage of such a macro is demonstrated here:

(:require [material-ui.styles :as m])

(m/let [{:keys [leftPad]} {:leftPad 
                           {:paddingLeft 8}}]
 ;; `leftPad` is now the _className_ associated with {:paddingLeft 8} 
@sashton
sashton / explore_datafy_nav.clj
Last active January 18, 2023 17:50
Clojure datafy/nav exploration
(ns explore-datafy-nav
"Sample code demonstrating naving around a random graph of data.
The graph very likely will have circular references, which is not a problem.
To see the results, execute the entire file.
Each step in the nav process will be printed out, as well as the initial db.
Subsequent executions will generate a new random db."
(:require [clojure.datafy :refer [datafy nav]]))
(defn generate-db
"Generate a random database of users and departments.
@ikitommi
ikitommi / user.clj
Last active April 5, 2020 16:38
Documenting malli keys and values
(require '[malli.core :as m])
;; using :and
(def Name
[:and {:documentation "Human name"} string?])
;; adding props to predicate schema
(def Name
[string? {:documentation "Human name"}])