Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / Log-in-Form-.markdown
Created February 13, 2015 20:34
Log in Form
anonymous
anonymous / Sticky-menu-on-scroll.markdown
Created February 14, 2015 04:56
Sticky menu on scroll
@taniarascia
taniarascia / index.html
Last active May 28, 2024 00:15
HTML Skeleton file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
@JonCatmull
JonCatmull / file-size.pipe.ts
Last active April 14, 2024 14:27
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
/**
* @license
* Copyright (c) 2019 Jonathan Catmull.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@Chiff
Chiff / DeepObject.ts
Last active October 7, 2018 09:42
DeepObject allows you to `set` and `get` values in object by strings without eval.
// yarn add gist:5ceba1081bbf0162b98860b34a511a92
// npm install gist:5ceba1081bbf0162b98860b34a511a92
export const DeepObject = {
set: setDeep,
get: getDeep
};
// https://stackoverflow.com/a/6491621
function getDeep(obj: Object, path: string) {
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@wildhart
wildhart / dateProtypes.js
Last active March 21, 2023 02:11
Date prototype functions
Date.prototype.addMins = function(mins) {
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original
dat.setMinutes(dat.getMinutes() + mins*1); // force mins to be integer instead of string
return dat;
};
Date.prototype.addDays = function(days) {
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original
dat.setDate(dat.getDate() + days*1); // force days to be integer instead of string
return dat;