Skip to content

Instantly share code, notes, and snippets.

View wilkerlucio's full-sized avatar

Wilker Lúcio wilkerlucio

View GitHub Profile
var CLOSURE_UNCOMPILED_DEFINES = {"goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING": true};
var CLOSURE_NO_DEPS = true;
var requireFile = function (src) {
var script = document.createElement("script");
script.src = chrome.extension.getURL(src);
script.defer = false;
script.async = false;
document.body.appendChild(script);
};
requireFile("util/overrides-simple.js");
{
"manifest_version": 2,
"name": "Figwheel Chrome Content Script Demo",
"version": "1",
"description": "",
"content_scripts": [
{
"matches": ["*://clojure.org/*"],
"js": [
"content-script.js"
@wilkerlucio
wilkerlucio / overrides.js
Last active March 29, 2016 17:46
Figwheel Chrome Content Script
var resourceURL = function (src) {
return chrome.extension.getURL("js/goog/" + src);
};
var loadSync = function(src) {
var xhr = new XMLHttpRequest();
xhr.open("GET", src, false);
xhr.send(null);
return xhr.responseText;
@wilkerlucio
wilkerlucio / manifest.json
Last active March 29, 2016 17:47
Figwheel Chrome Content Script
{
"manifest_version": 2,
"name": "Figwheel Chrome Content Script Demo",
"version": "1",
"description": "",
"content_scripts": [
{
"matches": ["*://clojure.org/*"],
"js": [
"util/overrides.js",
@wilkerlucio
wilkerlucio / figwheel.clj
Created March 29, 2016 16:39
Figwheel Chrome Content Script
(ns user
(:require [figwheel-sidecar.repl-api :as ra]))
(def figwheel-config
{:figwheel-options {:server-port 3449}
;; builds to focus on
:build-ids ["content-script"]
;; load build configs from project file
:all-builds (figwheel-sidecar.system/get-project-builds)})
@wilkerlucio
wilkerlucio / project.clj
Last active March 29, 2016 16:51
Figwheel Chrome Content Script
(defproject chrome-content-script "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.8.40" :scope "provided"]
[figwheel-sidecar "0.5.2"]]
:source-paths ["src"]
generate-spaces("n" 0, "xs" 20px, "s" 40px, "m" 120px, "l" 100px, "xl" 240px);
// examples:
// pan = padding all none
// mvxs = margin vertical x-small
(defmulti render :type)
(defn render-off-screen [f w h]
(let [canvas (doto (.createElement js/document "canvas")
(aset "width" w) (aset "height" h))
ctx (.getContext canvas "2d")]
(f ctx)
canvas))
(defn clear-canvas [canvas]
(ns smgui.dirscan
(:require-macros [cljs.core.async.macros :refer [go go-loop]]
[swannodette.utils.macros :refer [dochan <? go-try]])
(:require [cljs.core.async :refer [chan <! >! put! close!]]
[swannodette.utils.reactive :as r]))
(def nodepath (js/require "path"))
(def dir-separator (.-sep nodepath))
(def fs (js/require "fs"))
(def test-path "/Volumes/WilkerWD/Downloads/Torrent")