Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / gist:11264471
Created April 24, 2014 18:24
4chan source code leak
<?
if(file_exists('/www/global/lockdown')) {
if($_COOKIE['4chan_auser'] && $_COOKIE['4chan_apass'] && ($_POST['mode']=='usrdel'||$_GET['mode']=='latest')) {
// ok
}
else {
die('Posting temporarily disabled. Come back later!<br/>&mdash;Team 4chan (uptime? what\'s that?)');
}
}
include_once "./yotsuba_config.php";
(defn pgobj->clj [^org.postgresql.util.PGobject pgobj]
(let [type (.getType pgobj)
value (.getValue pgobj)]
(case type
"json" (cheshire.core/parse-string value true)
"jsonb" (cheshire.core/parse-string value true)
"citext" (str value)
value)))
(extend-protocol next.jdbc.result-set/ReadableColumn
(defn between [from target to]
(and (<= from target) (<= target to)))
(defn calculate-loan-size
[loan-amount]
(cond
(between 1 loan-amount 10000) :small
(between 10001 loan-amount 50000) :modest
(between 50001 loan-amount 150000) :large
(>= loan-amount 150001) :jumbo))
(defn calculate-loan-size
[loan-amount]
(cond
#d (between 1 loan-amount 10000) :small
#d (between 10001 loan-amount 50000) :modest
#d (between 50001 loan-amount 150000) :large
#d (>= loan-amount 150001) :jumbo))
[{0 [[1 :same-values (between 1 loan-amount 10000)] false]}
{1 [[1 :same-values (between 10001 loan-amount 50000)] false]}
{2 [[1 :same-values (between 50001 loan-amount 150000)] false]}
{3 [[1 :same-values (>= loan-amount 150001)] false]}]
(def log-store (atom {}))
(defn debug [tag val]
(swap! log-store update-in [tag] #(conj (or % []) val))
val)
(defn logs
[tag & functions]
(let [tag (if (number? tag)
(nth (keys @log-store) tag)
{d user/debug-data-reader}
{:aliases {:dev {:extra-paths ["/Users/dliman/.clojure"]}}}
(use-package! smartparens
:init
(map! :map smartparens-mode-map
...
"s-5" #'user-reset-log-store
"s-6" #'user-tags
"s-7" #'user-logs))
;; or
(defun user-reset-log-store ()
(interactive)
(cider-interactive-eval "(reset! user/log-store {})"))
(defun user-tags ()
(interactive)
(cider--pprint-eval-form "(user/tags)"))
(defun user-logs (&optional index-or-name)
(interactive)