Skip to content

Instantly share code, notes, and snippets.

View DarrenN's full-sized avatar
🌵
(on-a vision-quest)

Darren DarrenN

🌵
(on-a vision-quest)
View GitHub Profile
@DarrenN
DarrenN / logging.rkt
Created May 13, 2018 13:46 — forked from Metaxal/logging.rkt
Simple usage of Racket's logging facility
#lang racket/base
; One way to define a logger
(define lg (make-logger 'my-logger))
; Define a receiver for this logger, along with a log level
(define rc (make-log-receiver lg 'error)) ; also try with 'debug
; Another way to define a logger, with additional forms
(define-logger lg2)
(define rc2 (make-log-receiver lg2-logger 'debug))
@DarrenN
DarrenN / trace.log-rkt
Created September 1, 2017 17:30 — forked from greghendershott/trace.log-rkt
Make racket/trace output go to a logger
#lang racket/base
(require racket/format
racket/list
racket/match
racket/trace)
(provide (all-defined-out)
(all-from-out racket/trace))
syntax where = function(ctx) {
const binaryOps = ["or", "and", "==", ">", "<", "-", "+", "*", "/", "."];
const dummy = #`dummy`.get(0);
function matchNext(names) {
const marker = ctx.mark();
const next = ctx.next();
ctx.reset(marker);
return !next.done && names.includes(next.value.val());
}
@DarrenN
DarrenN / get-npm-package-version
Last active March 28, 2024 06:59 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@DarrenN
DarrenN / pr.md
Last active August 29, 2015 14:18 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

#!/bin/sh
git rev-parse 2>/dev/null
if [[ $? != 0 ]]
then
echo "Not a git repo"
return
fi
(ns user)
(def app
"Intenal Helper"
(fnil conj []))
(defprotocol PathSeq
(path-seq* [form path] "Helper for path-seq"))
(extend-protocol PathSeq
;; Updated tutorial code for Om 0.1.6, 2014-01-16
;; http://www.lexicallyscoped.com/2013/12/25/slice-of-reactjs-and-cljs.html
;; See comments below for details on the changes.
(def app-state
(atom {:comments [{:author "Pete Hunt" :text "This is a comment."}
{:author "Jordan Walke" :text "This is *another* coment"}]}))
(defn comment [{:keys [author text]} owner]
(om/component
define([
], function() {
return {
componentDidMount: function() {
this._boundForceUpdate = this.forceUpdate.bind(this, null);
this.getBackboneObject().on("all", this._boundForceUpdate, this);
},
componentWillUnmount: function() {
this.getBackboneObject().off("all", this._boundForceUpdate);
},