惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

Ben Sturmfels activity

a806660f680d42b273679261861204a6bca0d372 to c29409aa274d301dfadebc6b0561f54220a956d2 · Sturm / Brown Hill Community Hub website · GitLab Upgrade to Django 6.0 and Wagtail 7.4 (33eb5d0c) · Commits · Sturm / J Ward website · GitLab Fix typo (a806660f) · Commits · Sturm / Brown Hill Community Hub website · GitLab Add basic rate limiting to reduce contact form spam (1290e900) · Commits · Sturm / Brown Hill Community Hub website · GitLab Update to Python 3.13 (3aa0cb50) · Commits · Sturm / J Ward website · GitLab Update to Python 3.13 (5c92eea9) · Commits · Sturm / Brown Hill Community Hub website · GitLab Sturm / Ballarat Blaze Hockey Club website · GitLab Commits · main · Sturm / Ballarat Blaze Hockey Club website · GitLab More PageSpeed (c371606a) · Commits · Sturm / J Ward website · GitLab Add meta description (4091449e) · Commits · Sturm / J Ward website · GitLab Add font-display to optimise FCP (5e477a06) · Commits · Sturm / J Ward website · GitLab Tweak logo margin (084ec605) · Commits · Sturm / J Ward website · GitLab Remove Foundation "menu" module (a0c97be2) · Commits · Sturm / J Ward website · GitLab Tweak menu button (d3417d23) · Commits · Sturm / J Ward website · GitLab 8b2f12afc8763989ec592fc0b5562b72e1320500 to 8fc28fcb25f7fd859e6e4d17f459975e00d603b3 · Sturm / J Ward website · GitLab Upgrade Wagtail (8b2f12af) · Commits · Sturm / J Ward website · GitLab a49779288bbf876198f5c4b1c7a5fad2e6b6fd43 to 4851cbcf75518803e900ec2816d32b5af6ee3d4c · Sturm / J Ward website · GitLab 15ef1e4f0181500d3d359eb6d5d4950301c9e6f4 to b1d8d88507a31a68dfb781b782dfeb2e4e753391 · Sturm / Brown Hill Community Hub website · GitLab Add FYI.md (15ef1e4f) · Commits · Sturm / Brown Hill Community Hub website · GitLab Switch to ruff for linting (a5c064cc) · Commits · Sturm / Brown Hill Community Hub website · GitLab Ben Sturmfels deleted project branch longclaw at Sturm / Brown Hill Community Hub website Boost font size on directory listings (8535ef09) · 提交 · Sturm / Brown Hill Community Hub website · GitLab
Convert menu JS to ClojureScript (954580af) · Commits · Sturm / J Ward website · GitLab
2026-03-12 · via Ben Sturmfels activity
Original line number Diff line number Diff line
{:deps {org.clojure/clojurescript {:mvn/version "1.12.134"}}}
Original line number Diff line number Diff line

/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
            ;var e,h=this||self;function l(a){var b=typeof a;return b!="object"?b:a?Array.isArray(a)?"array":b:"null"};function m(a,b){return a!==null&&b in a?a[b]:void 0};var p=class{constructor(a){if(n!==n)throw Error("SafeUrl is not meant to be built directly");this.U=a}toString(){return this.U.toString()}},n={};new p("about:invalid#zClosurez");new p("about:blank");const q={};class aa{constructor(){if(q!==q)throw Error("SafeStyle is not meant to be built directly");this.T=""}toString(){return this.T.toString()}}new aa;const r={};class ba{constructor(){if(r!==r)throw Error("SafeStyleSheet is not meant to be built directly");this.S=""}toString(){return this.S.toString()}}new ba;function t(a){const b=a.length;if(b>0){const c=Array(b);for(let d=0;d<b;d++)c[d]=a[d];return c}return[]};const u={};class ca{constructor(){var a=h.trustedTypes&&h.trustedTypes.emptyHTML||"";if(u!==u)throw Error("SafeHtml is not meant to be built directly");this.R=a}toString(){return this.R.toString()}}new ca;function v(a,b){a!=null&&this.append.apply(this,arguments)}e=v.prototype;e.m="";e.set=function(a){this.m=""+a};e.append=function(a,b,c){this.m+=String(a);if(b!=null)for(let d=1;d<arguments.length;d++)this.m+=arguments[d];return this};e.clear=function(){this.m=""};e.toString=function(){return this.m};var w={},x={};if(typeof w==="undefined"||typeof x==="undefined"||typeof y==="undefined")var y={};if(typeof w==="undefined"||typeof x==="undefined"||typeof z==="undefined")var z=null;if(typeof w==="undefined"||typeof x==="undefined"||typeof da==="undefined")var da=null;if(typeof w==="undefined"||typeof x==="undefined"||typeof ea==="undefined")var ea=null;function A(a){return a!=null&&a!==!1}function B(a,b){return a[l(b==null?null:b)]?!0:a._?!0:!1}
function C(a,b){var c=b==null?null:b.constructor;return Error(["No protocol method ",a," defined for type ",A(A(c)?c.X:c)?c.O:l(b),": ",b].join(""))}var D=typeof Symbol!=="undefined"&&l(Symbol)==="function"?Symbol.iterator:"@@iterator";function E(){}function F(a){if(a!=null&&a.B!=null)a=a.B(a);else{var b=F[l(a==null?null:a)];if(b!=null)a=b.i?b.i(a):b.call(null,a);else if(b=F._,b!=null)a=b.i?b.i(a):b.call(null,a);else throw C("ICounted.-count",a);}return a}function G(){}
var fa=function(){function a(d,f,g){var k=H[l(d==null?null:d)];if(k!=null)return k.o?k.o(d,f,g):k.call(null,d,f,g);k=H._;if(k!=null)return k.o?k.o(d,f,g):k.call(null,d,f,g);throw C("IIndexed.-nth",d);}function b(d,f){var g=H[l(d==null?null:d)];if(g!=null)return g.g?g.g(d,f):g.call(null,d,f);g=H._;if(g!=null)return g.g?g.g(d,f):g.call(null,d,f);throw C("IIndexed.-nth",d);}var c=null;c=function(d,f,g){switch(arguments.length){case 2:return b.call(this,d,f);case 3:return a.call(this,d,f,g)}throw Error("Invalid arity: "+
arguments.length);};c.g=b;c.o=a;return c}(),H=function H(a){switch(arguments.length){case 2:return H.g(arguments[0],arguments[1]);case 3:return H.o(arguments[0],arguments[1],arguments[2]);default:throw Error(["Invalid arity: ",arguments.length].join(""));}};H.g=function(a,b){return a!=null&&a.F!=null?a.F(a,b):fa.g(a,b)};H.o=function(a,b,c){return a!=null&&a.G!=null?a.G(a,b,c):fa.o(a,b,c)};
function I(a){if(a!=null&&a.v!=null)a=a.v(a);else{var b=I[l(a==null?null:a)];if(b!=null)a=b.i?b.i(a):b.call(null,a);else if(b=I._,b!=null)a=b.i?b.i(a):b.call(null,a);else throw C("ISeq.-first",a);}return a}function J(a,b){if(a!=null&&a.u!=null)a=a.u(a,b);else{var c=J[l(a==null?null:a)];if(c!=null)a=c.g?c.g(a,b):c.call(null,a,b);else if(c=J._,c!=null)a=c.g?c.g(a,b):c.call(null,a,b);else throw C("IEquiv.-equiv",a);}return a}function ha(){}
function K(a){if(a!=null&&a.A!=null)a=a.A(a);else{var b=K[l(a==null?null:a)];if(b!=null)a=b.i?b.i(a):b.call(null,a);else if(b=K._,b!=null)a=b.i?b.i(a):b.call(null,a);else throw C("ISeqable.-seq",a);}return a}function ia(){}function ja(){}var L=typeof Math!=="undefined"&&typeof Math.imul!=="undefined"?function(a,b){return Math.imul(a,b)}:function(a,b){var c=a&65535,d=b&65535;return c*d+((a>>>16&65535)*d+c*(b>>>16&65535)<<16>>>0)|0};
function M(a){if(a==null)return null;if(a!=null&&(a.h&8388608||y===a.M))return a.A(null);if(a instanceof Array||typeof a==="string")return a.length===0?null:new N(a,0);if(a!=null&&a[D]!=null)return ka(m.call(null,a,D).call(a));if(B(ha,a))return K(a);throw Error([O(a)," is not ISeqable"].join(""));}function P(a){if(a==null)return null;if(a!=null&&(a.h&64||y===a.I))return a.v(null);a=M(a);return a==null?null:I(a)}
function Q(a){a==null?a=null:a!=null&&(a.h&128||y===a.W)?a=a.H():(a=a!=null?a!=null&&(a.h&64||y===a.I)?a.C():(a=M(a))?a.C():R:R,a=M(a));return a}var S=function S(a){switch(arguments.length){case 1:return S.i(arguments[0]);case 2:return S.g(arguments[0],arguments[1]);default:for(var c=[],d=arguments.length,f=0;;)if(f<d)c.push(arguments[f]),f+=1;else break;return S.K(arguments[0],arguments[1],2<c.length?new N(c.slice(2),0):null)}};S.i=function(){return!0};
S.g=function(a,b){return a==null?b==null:a===b||J(a,b)};S.K=function(a,b,c){for(;;){if(S.g(a,b))if(Q(c)){a=b;b=P(c);c=Q(c);continue}else return S.g(b,P(c));else return!1;break}};function T(a){this.s=a}T.prototype.next=function(){if(this.s!=null){var a=P(this.s);this.s=Q(this.s);return{value:a,done:!1}}return{value:null,done:!0}};function U(a,b){this.value=a;this.P=b;this.D=null;this.h=8388672}U.prototype.A=function(){return this};U.prototype.v=function(){return this.value};
U.prototype.C=function(){this.D==null&&(this.D=ka(this.P));return this.D};function ka(a){var b=a.next();return A(b.done)?null:new U(b.value,a)}function la(a){a=L(a|0,-862048943);a=0^(L(a<<15|a>>>-15,461845907)|0);a=(L(a<<13|a>>>-13,5)+-430675100|0)^0;a=L(a^a>>>16,-2048144789);L(a^a>>>13,-1028477387)}la(1);la(0);E["null"]=!0;F["null"]=function(){return 0};Date.prototype.u=function(a,b){return b instanceof Date&&this.valueOf()===b.valueOf()};J.number=function(a,b){return a===b};
function V(a){return a!=null?a.h&2||y===a.J?!0:a.h?!1:B(E,a):B(E,a)}function W(a,b,c){var d=X(a);if(c>=d)return-1;!(c>0)&&c<0&&(c+=d,c=0>c?0:c);for(;;)if(c<d){if(S.g(ma(a,c),b))return c;c+=1}else return-1}function Y(a,b,c){var d=X(a);if(d===0)return-1;c>0?(--d,c=d<c?d:c):c=c<0?d+c:c;for(;;)if(c>=0){if(S.g(ma(a,c),b))return c;--c}else return-1}function N(a,b){this.j=a;this.l=b;this.h=166592766}e=N.prototype;e.equiv=function(a){return this.u(null,a)};
e.indexOf=function(){var a=null;a=function(b,c){switch(arguments.length){case 1:return W(this,b,0);case 2:return W(this,b,c)}throw Error("Invalid arity: "+arguments.length);};a.i=function(b){return W(this,b,0)};a.g=function(b,c){return W(this,b,c)};return a}();
e.lastIndexOf=function(){function a(c){return Y(this,c,X(this))}var b=null;b=function(c,d){switch(arguments.length){case 1:return a.call(this,c);case 2:return Y(this,c,d)}throw Error("Invalid arity: "+arguments.length);};b.i=a;b.g=function(c,d){return Y(this,c,d)};return b}();e.F=function(a,b){a=b+this.l;if(0<=a&&a<this.j.length)return this.j[a];throw Error("Index out of bounds");};e.G=function(a,b,c){a=b+this.l;return 0<=a&&a<this.j.length?this.j[a]:c};
e.H=function(){return this.l+1<this.j.length?new N(this.j,this.l+1):null};e.B=function(){var a=this.j.length-this.l;return 0>a?0:a};e.u=function(a,b){if(na(b))if(V(this)&&V(b)&&X(this)!==X(b))a=!1;else a:{a=M(this);for(b=M(b);;){if(a==null){a=b==null;break a}if(b!=null&&S.g(P(a),P(b)))a=Q(a),b=Q(b);else{a=!1;break a}}a=void 0}else a=null;return a==null?!1:a===!1?!1:!0};e.v=function(){return this.j[this.l]};e.C=function(){return this.l+1<this.j.length?new N(this.j,this.l+1):R};
e.A=function(){return this.l<this.j.length?this:null};N.prototype[D]=function(){return new T(M(this))};J._=function(a,b){return a===b};function X(a){if(a!=null)if(a!=null&&(a.h&2||y===a.J))a=a.B(null);else if(a instanceof Array)a=a.length;else if(typeof a==="string")a=a.length;else if(a!=null&&(a.h&8388608||y===a.M))a:{a=M(a);for(var b=0;;){if(V(a)){a=b+F(a);break a}a=Q(a);b+=1}a=void 0}else a=F(a);else a=0;return a}
function ma(a,b){if(typeof b!=="number")throw Error("Index argument to nth must be a number");if(a==null)return a;if(a!=null&&(a.h&16||y===a.L))return a.F(null,b);if(a instanceof Array){if(-1<b&&b<a.length)return a[b|0];throw Error("Index out of bounds");}if(typeof a==="string"){if(-1<b&&b<a.length)return a.charAt(b|0);throw Error("Index out of bounds");}if(a!=null&&(a.h&64||y===a.I)||a!=null&&(a.h&16777216||y===a.N)){if(b<0)throw Error("Index out of bounds");var c;a:{for(c=a;;){if(c==null)throw Error("Index out of bounds");
if(b===0){if(M(c)){c=P(c);break a}throw Error("Index out of bounds");}if(c!=null?c.h&16||y===c.L||(c.h?0:B(G,c)):B(G,c)){c=H.g(c,b);break a}if(M(c))c=Q(c),--b;else throw Error("Index out of bounds");}c=void 0}return c}if(B(G,a))return H.g(a,b);c=Error;b=O;a=a==null?null:a.constructor;var d=a.O;a=A(d)?d:O(a);throw c(["nth not supported on this type ",b(a)].join(""));}function na(a){return a!=null?a.h&16777216||y===a.N?!0:a.h?!1:B(ia,a):B(ia,a)}
var O=function O(a,b){if(a==null)return"";if(void 0===b)return[a].join("");for(var d=new v,f=arguments,g=f.length,k=0;;)if(k<g)d.append(O(f[k])),k+=1;else return d.toString()};function Z(){this.h=65937614}e=Z.prototype;e.equiv=function(a){return this.u(null,a)};
e.indexOf=function(){var a=null;a=function(b,c){switch(arguments.length){case 1:return W(this,b,0);case 2:return W(this,b,c)}throw Error("Invalid arity: "+arguments.length);};a.i=function(b){return W(this,b,0)};a.g=function(b,c){return W(this,b,c)};return a}();
e.lastIndexOf=function(){function a(c){return Y(this,c,X(this))}var b=null;b=function(c,d){switch(arguments.length){case 1:return a.call(this,c);case 2:return Y(this,c,d)}throw Error("Invalid arity: "+arguments.length);};b.i=a;b.g=function(c,d){return Y(this,c,d)};return b}();e.H=function(){return null};e.B=function(){return 0};e.u=function(a,b){return(b!=null?b.h&33554432||y===b.V||(b.h?0:B(ja,b)):B(ja,b))||na(b)?M(b)==null:!1};e.v=function(){return null};e.C=function(){return R};e.A=function(){return null};
var R=new Z;Z.prototype[D]=function(){return new T(M(this))};if(typeof w==="undefined"||typeof x==="undefined"||typeof oa==="undefined")var oa=null;typeof console!=="undefined"&&(z=function(){var a=arguments;return console.log.apply(console,t.call(null,a))},da=function(){var a=arguments;return console.error.apply(console,t.call(null,a))});if(typeof w==="undefined"||typeof x==="undefined"||typeof pa==="undefined")var pa=function(){throw Error("cljs.core/*eval* not bound");};console.log("Initialising menu");var qa=document.querySelector("[data-toggle]"),ra=document.getElementById(m.call(null,qa.attributes,"data-toggle").value);qa.addEventListener("click",function(a){return function(){return S.g(a.style.display,"block")?a.style.display="":a.style.display="block"}}(ra));
 No newline at end of file
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ STATICFILES_FINDERS = [

STATICFILES_DIRS = [
    os.path.join(PROJECT_DIR, 'static'),
    os.path.join(BASE_DIR, 'out'),  # ClojureScript
]

STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static')
Original line number Diff line number Diff line
@@ -54,26 +54,7 @@

        {# Global javascript #}
        {% compress js %}
        <script>
         'use strict';
         let button = document.querySelector('[data-toggle]');
         let target_id = button.attributes['data-toggle'].value;
         let target_el = document.getElementById(target_id);

         function showHideMenu(el) {
           return function () {
             console.log(el.style);
             if (el.style.display !== 'block') {
               el.style.display = 'block';
             }
             else {
               el.style.display = '';
             }
           }
         }

         button.addEventListener('click', showHideMenu(target_el));
        </script>
        <script src="{% static 'main.js' %}"></script>
        {% endcompress %}

        {% include '_analytics.html' %}
Original line number Diff line number Diff line
(ns jward.core
  "Menu open/close feature"
  (:require [goog.object :as gobj]))

;; There's not much here in the way of code. This was mostly written to explore
;; the use-case of ClojureScript for small things.
;;
;; For this situation, the tooling and config for NPM and Shadow CLJS feels like
;; far too much ceremony. I just want ClojureScript the language, an
;; editor-connected REPL and a simple way to integrate it with an existing
;; server-side application. The initial version of this code was written in
;; inline JavaScript in less than an hour, so any additional tooling needs to
;; pay its way.
;;
;; I agree in-principle with David Nolen on the use of simpler tooling, but at
;; present cljs.main doesn't quite cut it. It took me hours and hours of
;; experimenting to work through the intricate command line, to try and give up
;; on CIDER and to find an inf-clojure workflow that is good enough.
;;
;; For development, run:
;;
;; M-x (inf-clojure "clojure -M --main cljs.main --verbose --compile-opts build.edn --compile jward.core --repl")
;;
;; For production run:
;;
;; clojure -M --main cljs.main --verbose --compile-opts build.edn --optimizations advanced --compile jward.core
;;
;; I also need a way to deal with compiled assets such that I can come back to a
;; codebase and have it work without first having to get a ClojureScript
;; running. Perhaps git-lfs?

(defn show-hide-menu [el]
  (fn []
    (if (not= (.. el -style -display) "block")
      (set! (.. el -style -display) "block")
      (set! (.. el -style -display) ""))))

(defn init []
  (js/console.log "Initialising menu")
  (let [button (js/document.querySelector "[data-toggle]")
        target-id (-> button .-attributes (gobj/get "data-toggle") .-value)
        target-el (js/document.getElementById target-id)
        handler (show-hide-menu target-el)]
    (.addEventListener button "click" handler)))

(init)

(comment
  ;; Can hot-reload from the REPL:
  (require 'jward.core :reload))