Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lukebarton's full-sized avatar

Luke Barton lukebarton

View GitHub Profile
@lukebarton
lukebarton / example.js
Created January 24, 2011 22:32
Underscore Example
_.map([1, 2, 3], function(n){ return n * 2; });
_([1, 2, 3]).map(function(n){ return n * 2; });
<?php
// Don't touch these
$elementLevel = array(
0 => 'zero',
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five',
6 => 'six',
'use strict'
/**
* I'm using node 5.10.1 --harmony_default_parameters reporting v8 '4.6.85.31'
*
* [Bug] Default Parameters referring to class names do not work with Fat Arrow functions
* So I figured, maybe it's just a difference between Fat Arrow Functions and Full Functions,
* but then I realised that by declaring a Full Function referencing the class,
* it caused the Fat Arrow Function to execute fine. This tells me it's a bonafide bug.
*/

Keybase proof

I hereby claim:

  • I am lukebarton on github.
  • I am lukebarton (https://keybase.io/lukebarton) on keybase.
  • I have a public key whose fingerprint is CA37 954D 2064 4E28 72AC C953 0A3B B4D4 AB34 FAF5

To claim this, I am signing this object:

@lukebarton
lukebarton / lifebit.js
Created March 20, 2018 17:46
If I were to make improvements, I'd sort out the interface and return values around the resolve and getConflicts functions - they could probably use new names too.
module.exports = {
makeRelationshipSet: () => ({
required: {},
conflicting: {}
}),
dependsOn: (package, requiredDependency, ruleSet) => {
initPackage(package, ruleSet);
initPackage(requiredDependency, ruleSet);
ruleSet.required[package].push(requiredDependency);
@lukebarton
lukebarton / lifebit.js
Created March 20, 2018 17:47
If I were to make improvements, I'd sort out the interface and return values around the resolve and getConflicts functions - they could probably use new names too.
module.exports = {
makeRelationshipSet: () => ({
required: {},
conflicting: {}
}),
dependsOn: (package, requiredDependency, ruleSet) => {
initPackage(package, ruleSet);
initPackage(requiredDependency, ruleSet);
ruleSet.required[package].push(requiredDependency);
@lukebarton
lukebarton / Autotemplate
Last active November 9, 2022 10:41
Quick snip of some templates for Palaeocitharae on the Obsidian Discord
<%*
if ((new RegExp(/^\d{4}$/)).test(tp.file.title)) {
await tp.file.move(tp.date.now("[LifeOS]/YYYY/YYYY", 0, tp.file.title, "YYYY"));
tR += await tp.file.include("[[Year Note Template]]");
}
if ((new RegExp(/^\d{4}-Q\d$/)).test(tp.file.title)) {
await tp.file.move(tp.date.now("[LifeOS]/YYYY/YYYY-[Q]Q", 0, tp.file.title, "YYYY-[Q]Q"));
tR += await tp.file.include("[[Quarter Note Template]]");
}
if ((new RegExp(/^\d{4}-W\d{2}$/)).test(tp.file.title)) {