Skip to content

Instantly share code, notes, and snippets.

@benhughes
benhughes / gist:1cd1a3f6239d51ffdf8fbf2e3efe7286
Last active February 4, 2024 18:11
Obsidian Templater - Copy link to current block
<%*
const currentFile = app.workspace.activeLeaf.view.file;
const editor = app.workspace.activeLeaf.view.sourceMode.cmEditor
const cursor = editor.getCursor();
const cursorLine = cursor.line;
const lineText = editor.getLine(cursor.line);
let lineId
if (lineText.contains(" ^")) {
const lineTextSplit = lineText.split(" ^");
This file has been truncated, but you can view the full file.
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
@benhughes
benhughes / PrettierFile.js
Last active August 31, 2019 19:28
Changing default to true
const {prettier, parserBabylon} = importModule('./prettier-scriptable');
const prettierConfig = {
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: false,
parser: 'babel',
plugins: [parserBabylon],
};

#A brief intro into Stateless functions#

So stateless functions are new in React 0.14 which are quite interesting. They look a bit like this.

const Test = ({name, amount}) => {
 return <div className="test">{name} has £{amount}</div>;
};

ReactDOM.render(<Test name="ben" amount="-2000" />) //  <div className="test">ben has £-200</div> 
@benhughes
benhughes / .jshintrc
Last active January 4, 2016 14:19
My default jshintrc file
{
"undef": true,
"unused": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"immed": true,
"indent": 4,