Skip to content

Instantly share code, notes, and snippets.

View ITSecMedia's full-sized avatar
🃏
If anything is worth doing, do it with all your heart. --Buddha

Norman Eckstein ITSecMedia

🃏
If anything is worth doing, do it with all your heart. --Buddha
View GitHub Profile
@ITSecMedia
ITSecMedia / promises-cljs.md
Created October 7, 2021 20:38 — forked from pesterhazy/promises-cljs.md
Promises in ClojureScript

Chaining promises

Chaining promises in ClojureScript is best done using the thread-first macro, ->. Here's an example of using the fetch API:

(-> (js/fetch "/data")
    (.then (fn [r]
             (when-not (.-ok r)
               (throw (js/Error. "Could not fetch /data")))
             (.json r)))
87 luminus: a template for creating Luminus applications
7 mala: A Leiningen template for Mala
1 maple: A leinginen template with MPL
3 mesos-framework: A template for setting up mesos-frameworks using component.
3 mies-brepl: A minimal ClojureScript project template with REPL
7 mies-node: A minimal ClojureScript Node.js project template
27 mies-om: A minimal Om project template
2 mies-weasel: A minimal ClojureScript project template with Weasel REPL, forked from mies.
40 mies: A minimal ClojureScript project template
3 mies: FIXME: write description
@ITSecMedia
ITSecMedia / all-lein-templates.txt
Created July 25, 2020 15:57 — forked from anonymous/all-lein-templates.txt
for i in {1..28} ; do lein search lein-template $i ; done | grep '^\[' | perl -pe 's,^\[,,; s,/.*?],:,' | sort | uniq -c | tee all-lein-templates.txt
1 acorn: A Leiningen template for a ClojureScript setup with Figwheel, Austin, Om.
8 amp: Leiningen template for AMP (Alfresco Module Package) projects.
1 angular-cl2: A Leiningen template for using AngularJS and ChlorineJS
1 angular: Clojure and AngularJS in perfect harmony.
6 angular: Clojure and AngularJS in perfect harmony. $ lein new angular <name>
2 angularjs-app: Leiningen template for web application with http-kit and angularjs
5 angular-simple: Clojure and AngularJS $ lein new angular-simple <name>
1 aperiodic-cljs: My cljs development starting point. Basically ripped from lein-cljsbuild.
1 apijr: clojurescript project template
1 appfgo: 'lein new' template for Funcgo application
@ITSecMedia
ITSecMedia / 00_destructuring.md
Created March 31, 2020 21:01 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@ITSecMedia
ITSecMedia / Dapper.Extensions.fs
Created October 4, 2019 16:15 — forked from Dzoukr/Dapper.Extensions.fs
F# extensions for Dapper
module Dapper.Extensions
open System
open System.Data.SqlClient
open Dapper
let extractValue (x:obj) =
match x with
| null -> null
| _ -> match x.GetType().GetProperty("Value") with
@ITSecMedia
ITSecMedia / ConstrainedTypesExamples.fsx
Created May 25, 2019 19:59 — forked from swlaschin/ConstrainedTypesExamples.fsx
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
@ITSecMedia
ITSecMedia / gist:9cb8cf6279471531129a0a90f9556680
Created December 15, 2017 10:04 — forked from msmuenchen/gist:9318327
KeePass v2.x (KDBX v3.x) file format
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)
function copyToClipboard( text ){
var copyDiv = document.createElement('div');
copyDiv.contentEditable = true;
document.body.appendChild(copyDiv);
copyDiv.innerHTML = text;
copyDiv.unselectable = "off";
copyDiv.focus();
document.execCommand('SelectAll');
document.execCommand("Copy", false, null);
document.body.removeChild(copyDiv);
@ITSecMedia
ITSecMedia / main.go
Created February 11, 2017 19:54 — forked from dmitshur/main.go
Server for HTTPS protocol. Redirects to canonical hosts, reverse proxies requests to internal backing servers.
// Server for HTTPS protocol. Redirects to canonical hosts, reverse proxies requests to internal backing servers.
package main
import (
"crypto/tls"
"flag"
"log"
"net/http"
"net/http/httputil"
"time"