Skip to content

Instantly share code, notes, and snippets.

View dalgard's full-sized avatar

Kristian Dalgård dalgard

  • Various Productions
  • Aarhus, Denmark
View GitHub Profile
@function gcd($a, $b) {
@return if($b > 0, gcd($b, $a % $b), $a);
}
@function get-steps($elements, $page-size) {
@return $elements / gcd($page-size, $elements);
}
@function is-active($n, $step, $elements, $page-size) {
@return $n > ($step * $page-size % $elements);
{
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"eofline": true,
"forin": true,
"indent": [
@dalgard
dalgard / gist:ddd1be585fc8d1af8676
Created November 13, 2015 11:43 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
{
"folders":
[
{
"file_exclude_patterns":
[
"*.sublime-workspace",
"*.map",
"*.min.*"
],
// Return the last truthy argument
Template.registerHelper("and", (...args) => _.reduce(popkw(args), (memo, item) => memo && item));
// Return the first truthy argument
Template.registerHelper("or", (...args) => _.reduce(popkw(args), (memo, item) => memo || item));
// Return whether all arguments are strictly equal
Template.registerHelper("is", (...args) => compareLeft(popkw(args), (a, b) => a === b));
// Return whether each argument is greater than the previous
# This regex throws away anything between quotes at the root level, and captures
# anything between parentheses preceded by a keyword at the root level
# It uses this technique: http://www.rexegg.com/regex-best-trick.html
/
(?: # Group
( \1 # Capturing group
['"] # Quotation mark
)
// Override the original behaviour from sewdn:collection-behaviours
CollectionBehaviours.defineBehaviour("trackable", function (getTransform, args) {
if (_.isArray(args[0]))
args = args[0];
// Track all updated fields or only a list of fields
if (args[0] === true) {
var track_field = args[1] || "updatedTrack",
slice = false;
<template name="openModal">
<button class="button" {{bind 'openModal: myModalTemplate'}}>Open modal</button>
</template>
@dalgard
dalgard / peopleMock.json
Last active July 21, 2022 20:10
JSON list of people (https://mockaroo.com/)
[{"id":1,"first_name":"Gary","last_name":"Ortiz","email":"[email protected]","country":"Indonesia","modified":"2015-05-16","vip":false},
{"id":2,"first_name":"Albert","last_name":"Williamson","email":"[email protected]","country":"China","modified":"2015-03-11","vip":true},
{"id":3,"first_name":"Mildred","last_name":"Fuller","email":"[email protected]","country":"Peru","modified":"2015-02-15","vip":true},
{"id":4,"first_name":"Russell","last_name":"Robinson","email":"[email protected]","country":"Belarus","modified":"2014-10-31","vip":false},
{"id":5,"first_name":"Laura","last_name":"Harper","email":"[email protected]","country":"Philippines","modified":"2015-01-14","vip":false},
{"id":6,"first_name":"Larry","last_name":"Sanders","email":"[email protected]","country":"China","modified":"2015-01-11","vip":false},
{"id":7,"first_name":"Michael","last_name":"Rice","email":"[email protected]","country":"Philippines","modified":"2014-12-06","vip":true},
{"id":8,"first_name":"Sara","last_name":"Harris",
@dalgard
dalgard / Sublime.md
Last active September 11, 2015 09:25

Sublime Text 3 preferences

My personal setup in OS X – for future reference.

Keyboard shortcuts

Key Action
Cmd + left/right Home/End