Skip to content

Instantly share code, notes, and snippets.

@examinedliving
examinedliving / git-help.md
Last active December 6, 2017 15:32
A collection of git commands that I find myself looking up frequently #cheat-sheet #git

A Collection of Git Commands That I find myself looking up regularly

Diff

Diff while ignoring end of line white space

git diff --ignore-space-at-eol
@examinedliving
examinedliving / pokerhands-codewars.js
Last active May 25, 2017 03:33
Work in progress. Codewars Kata Poker Hands
"https://www.codewars.com/kata/5739174624fc28e188000465/train/javascript"
var Result = { "win": 1, "loss": 2, "tie": 3 }
function PokerHand(hand) {
this.hand=hand;
this.handArray=Array.prototype.slice.call(hand);
this.getScore();
}
PokerHand.prototype.getScore=function(){
@examinedliving
examinedliving / vector-class.js
Created May 15, 2017 18:31
Codewars Kata for Vector Class. Tests fail on auxillary values equality. Everything else works.
// codewars link=https://www.codewars.com/kata/vector-class
var Vector = function(components) {
this.values = components;
this.result=components;
return this;
};
Vector.prototype.equals=function(){
return this.result;
}
@examinedliving
examinedliving / make-ratio.less
Last active December 4, 2017 19:39
Less.css mixin that creates a responsive box to hold image of a particular aspect ratio
////**
// * @file-name: make-ratio.less
// * @description A mixin that creates a box that will size responsively to the aspect ratio of an image at all sizes
// * @main make-ratio
// * @internal make-ratio-parent, make-ratio-child
// * @param {number} @width The Width as a number - This is the width of the aspect ratio, not that of the element, nor a percent
// * @param {number} @height The Height as a number - see @width for description required
// * @param {string} @child - this is the element that will be directly within the outer element of the ratio - defaults to a - only required for using @main mixin (.make-ratio)
// * @example
@examinedliving
examinedliving / MergedStringChecker.js
Last active May 11, 2017 17:17
Merged String Problem for Codewars.com
// working on Codewars Merged String Checker Kata
// fails with Test.expect(isMerge('Bananas from Bahamas','Bananas from am','Bahas'));
// this is a work in progress, and I'm bugged by why it is not working.
// https://www.codewars.com/kata/54c9fcad28ec4c6e680011aa/train/javascript
function isMerge(s, part1, part2) {
var str='';
var part3=[];
if(part1.length+part2.length!==s.length){
@examinedliving
examinedliving / Trello-label-color-mixin.less
Last active May 11, 2017 17:18
Mixin to generate CSS to change the label colors in Trello. Meant to be used with Stylish or another runtime css modifier.
// Trello mixin to use with stylish or something.
// Changes the trello card label colors based upon color variables
// wrapped it all in one mixin just for fun - the outer mixin is only useful for cleanliness and organization
.make-card-labels(){
// list of all label colors in Trello. Variable name must remain as they are for this mixin to work properly.
@red:#CF4647;
@examinedliving
examinedliving / iframePrint.js
Created April 11, 2017 14:49
Print from iFrame in current window, and add callbacks for before print, and after print.
(function() {
var beforePrint = function() {
console.log('Functionality to run before printing.');
};
var afterPrint = function() {
console.log('Functionality to run after printing');
};
var ifr=''//iframe ref;
ifr.focus();
var cw=''//ifr.contentWindow
@examinedliving
examinedliving / pietrisycamollaviadelrechiotemexity.md
Created March 22, 2017 21:46
what does pietrisycamollaviadelrechiotemexity mean

what does pietrisycamollaviadelrechiotemexity mean

@examinedliving
examinedliving / brandcolors.less
Last active May 11, 2017 17:54
Brandcolors as less variables
// less variables for brand-colors from the website: brandcolors.com
@aetna: #d20962;
@aetna-1: #00bce4;
@aetna-2: #7ac143;
@aetna-3: #00a78e;
@aetna-4: #f47721;
@aetna-5: #d20962;
@aetna-6: #7d3f98;
@examinedliving
examinedliving / flatIconCom-frontEnd-util.js
Created January 11, 2017 22:27
Something I've created to work with FlatIcon.com - probably only useful for me.
javascript: (function() {
var getItems = function() {
var have = localStorage.getItem('have');
have = typeof have === "undefined" ? {
"items": []
} : JSON.parse(have);
return have;
};
var putItems = function(pack, have) {
have = typeof have === "undefined" ? {