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 / get-npm-package-version
Last active April 17, 2024 16:57 — 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 / shortid.rb
Created November 20, 2011 18:02
Short unique ID (Ruby)
t = DateTime
id = t.now.strftime("%Y%m%d%k%M%S%L") # Get current date to the milliseconds
id = id.to_i.to_s(36) # will generate somthing like "5i0sp1h4tkc"
# Reverse it
id.to_i(36)
@DarrenN
DarrenN / .gitignore
Last active December 22, 2022 14:41 — forked from avescodes/Editing Clojure with Emacs
Emacs setup for Clojure
shibuya.el
dazza.el
elpa/
places
eshell/
.smex-items
ac-comphist.dat
projectile-bookmarks.eld
@DarrenN
DarrenN / codereviews.md
Last active April 13, 2021 02:06
How do you perform code reviews?
http://stackoverflow.com/questions/310813/how-do-you-perform-code-reviews

How are code reviews performed on your development team?

I've been a developer for several years now in several different companies and I have noticed that there isn't a consistent approach to performing code reviews.

At my current company, code reviews are non-existent, which has led to a significant decrease in the quality of the code. At previous jobs, code reviews ranged from just making sure coding standards were enforced to nazi-like line by line reviews that took days to complete.

So I'm wondering what its like for everyone else out there. And in particular, what tools do you use to perform the reviews? And do you find that code reviews help rather than add to the length of time needed for a given project?

@DarrenN
DarrenN / stop_words.txt
Created January 29, 2011 22:02
Naively parse a text removing stopwords
'tis
'twas
a
aah
aaron
abandon
abandoned
abbott
abby
abe
@DarrenN
DarrenN / net-lens.rkt
Created January 21, 2018 20:25
Fun with Lenses, structs and net/url in Racket
#lang racket/base
(require json
lens
net/url
net/url-string
net/head
racket/dict
racket/string)
@DarrenN
DarrenN / LiftFunctorDataThing.js
Created September 14, 2018 16:40
Pull a field from an object and set the object to the value of that field in a new object
// needs ramda.js
const enclose = curry((a, obj) => objOf(prop(a, obj))(obj))
var example = {'id': '123', 'foo': 'bar'};
enclose('id', example)
// {"123": {"foo": "bar", "id": "123"}}
@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))
@DarrenN
DarrenN / app.jsx
Created July 14, 2015 01:25
Use Material Design Lite's JS to handle layouts with React + Webpack
/* jshint esnext:true */
'use strict';
import React from 'react';
import Header from './header';
import Workspace from './workspace';
import Footer from './footer';
// Manually call upgradeElement / MaterialLayout on the main layout div *AFTER* its been rendered in the DOM.
export default React.createClass({