Skip to content

Instantly share code, notes, and snippets.

View ourmaninamsterdam's full-sized avatar

Justin Perry ourmaninamsterdam

View GitHub Profile
@ourmaninamsterdam
ourmaninamsterdam / readme.md
Created September 23, 2015 11:03
Completely uninstall node and npm

Completely uninstall node + npm:

  • go to /usr/local/lib and delete any node and node_modules
  • go to /usr/local/include and delete any node and node_modules directory
  • if you installed with brew install node, then run brew uninstall node in your terminal

Check your Home directory for any local or lib or include folders, and delete any node or node_modules from there go to /usr/local/bin and delete any node executable.

You may need to do the additional instructions as well:

@ourmaninamsterdam
ourmaninamsterdam / createRandomString.js
Created August 8, 2015 14:26
createRandomString()
function createRandomString(minLen, maxLen) {
var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''),
stringLen = Math.floor(Math.random() * (maxLen - minLen + 1)) + minLen,
string = '';
for(var i = 0; i < stringLen; i++) {
string += alphabet[Math.floor(Math.random() * alphabet.length)];
}
return string;
}
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active February 9, 2025 08:41
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
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:
@ourmaninamsterdam
ourmaninamsterdam / setCssAttributeValue.js
Created April 8, 2015 12:35
Set CSS attribute value
function setCSSAttributeSelectorValue(selector, value) {
return selector.slice(0, selector.lastIndexOf(']')) + '=' + value + ']';
}
@ourmaninamsterdam
ourmaninamsterdam / arrayzing.md
Last active June 8, 2022 23:49
Array Cheatsheet

Array Cheatsheet

Creating an array

var meals = ['breakfast', 'lunch', 'dinner'] ;

Or

@ourmaninamsterdam
ourmaninamsterdam / 1-cms_components.md
Last active August 29, 2015 14:16
Overview of CMS components

CMS Components

JavaScript

Displays characters remaining from a given total. Used with form inputs. Adds classes when active/above/below/equal the total character allowance.

Tests [y] Accessibility tested [n]

function getFunctionName (fn) {
return fn.toString().substr(0, fn.toString().indexOf('(')).replace('function ', '');
}
@ourmaninamsterdam
ourmaninamsterdam / SassMeister-input.scss
Last active August 29, 2015 14:11
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@mixin property($property, $multiple) {
@supports($property: 1rem){
#{$property}: ($multiple / $base-font-size) * 1rem;
};
#{$property}: $multiple * 1px;
def is_active?(path)
!!request.url.match(option[:path]) ? " is-active" : ""
end
@ourmaninamsterdam
ourmaninamsterdam / check.js
Last active August 29, 2015 14:08
Check if element is within viewport
Popover.prototype.isOverlappingViewport = function($el) {
return this.getElementBoundaries($el).top < 0? true : false ||
this.getElementBoundaries($el).bottom > $('body').height()? true : false ||
this.getElementBoundaries($el).left < 0? true : false ||
this.getElementBoundaries($el).right > $('body').width()? true : false;
};