Skip to content

Instantly share code, notes, and snippets.

View wilkerlucio's full-sized avatar

Wilker Lúcio wilkerlucio

View GitHub Profile
defmodule ChromeBookmarks do
defrecord Bookmark, name: nil, url: nil
def main do
query = System.get_env("QUERY")
bookmarks_from_file("/Users/wilkerlucio/Library/Application Support/Google/Chrome/Default/Bookmarks")
|> search_bookmarks(query)
|> output
end
@wilkerlucio
wilkerlucio / reset_windows
Created December 16, 2009 19:26
Reset Mac OS windows positions
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@wilkerlucio
wilkerlucio / natural-sort.clj
Last active May 18, 2022 14:16
Alphabetical/Natural sorting in Clojure/Clojurescript
(ns util.natural-sorting
(:refer-clojure :exclude [sort sort-by])
(:require [clojure.string]))
(defn parse-int [s]
#?(:clj (Long/parseLong s)
:cljs (js/parseInt s)))
(defn vector-compare [[value1 & rest1] [value2 & rest2]]
(let [result (compare value1 value2)]
@wilkerlucio
wilkerlucio / pathom-fulcro3.cljs
Created July 30, 2020 14:03
Example of Pathom with Fulcro 3
(defn pathom-remote [parser]
{:transmit! (fn transmit! [_ {::txn/keys [ast result-handler]}]
(let [edn (eql/ast->query ast)
ok-handler (fn [result]
(try
(result-handler (assoc result :status-code 200))
(catch :default e
(js/console.error e "Result handler for remote failed with an exception."))))
error-handler (fn [error-result]
(try
A for Andromeda
Aaagh! It's the Mr. Hell Show!
Aaahh!!! Real Monsters
Aaron Stone
Aaron's Way
The Abbott and Costello Show
Abby
The ABC Afterschool Special
About a Girl
Above the Law
@wilkerlucio
wilkerlucio / pathom-persistent-cache.clj
Last active March 3, 2020 13:42
Pathom cache extension example
(defn cache-resolver [resolver]
(update resolver ::pc/resolve
(fn [resolve]
(fn [{::keys [persistent-cache*] :as env} input]
(let [cache-key [(::pc/sym resolver) input (p/params env)]]
(if-let [[_ v] (find @persistent-cache* cache-key)]
v
(let [response (resolve env input)]
(swap! persistent-cache* assoc cache-key response)
response)))))))
@wilkerlucio
wilkerlucio / example.scss
Last active May 20, 2019 15:12 — forked from darren131/gist:3410875
Compass sprite resize mixin
$my-icons-spacing: 10px; // give some space to avoid little pixel size issues on resize
@import "my-icons/*.png";
$my-icons-sprite-dimensions: true;
@include all-my-icons-sprites;
// the fun part
@wilkerlucio
wilkerlucio / check-component.cljs
Created November 2, 2018 02:12
Generative testing for fulcro components
(ns your-ns
(:require [clojure.test.check.properties :as prop]
[com.wsscode.pathom.gen :as sgen]
[cljs.test :refer [is]]
[clojure.test.check.generators :as gen :include-macros true]
[fulcro.client.primitives :as fp]
[clojure.test.check :as tc]
[fulcro.client.mutations :as fm]
[clojure.data :as data]))
/*! tether 1.4.4 */
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.Tether = factory();
}
[{:com.wsscode.pathom.trace/event
:com.wsscode.pathom.parser/parse-loop,
:com.wsscode.pathom.trace/timestamp-leave 1535741953047,
:com.wsscode.pathom.trace/timestamp 1535741952740,
:com.wsscode.pathom.core/path [],
:com.wsscode.pathom.trace/relative-timestamp 0,
:com.wsscode.pathom.trace/duration 307}
{:key :fulcro.inspect.workspaces.ui.pathom-trace-cards/color,
:com.wsscode.pathom.trace/event
:com.wsscode.pathom.parser/process-key,