Skip to content

Instantly share code, notes, and snippets.

View amaxwell01's full-sized avatar

Andrew Maxwell amaxwell01

View GitHub Profile
@amaxwell01
amaxwell01 / bind_currying.js
Created August 6, 2013 16:54
How to use the bind method to perform currying
var multiply = function(x) {
return x * 2;
};
var myMath = {
_multiplyBy: 5,
multiply: function(x) {
return x * this._multiplyBy;
},
@amaxwell01
amaxwell01 / cover_letter.md
Last active December 20, 2015 09:39
My funny, yet perfect cover letter for a web developer position

Dear John Smith,

I'M SPIDER-MAN! [In a deep voice]

Ok, I'm not Spider-man, but I am a web developer... eh.. eh??

All joking aside, like Spider-man, I swing into action when problems arise. With great programming skills, comes great responsibility... Too much!?

With nearly a decade of hands-on expertise in front-end development, I also have the problem-solving, quality control, and organizational skills that you’re looking for.

@amaxwell01
amaxwell01 / missing_int_from_array.js
Last active June 15, 2021 15:32
How to find the missing numbers from an array of integers. Q: You’re given an array of N integers. N may be very large. You know that every integer 1-N appears once in the array, except there is one or more integer(s) missing.
/* ============================
* EXAMPLE 1:
* ============================ */
var numbers = [0,1,3,4,5,7,8]; // Missing 2,6
var lastNumber = numbers[numbers.length - 1];
var expectedSum = (lastNumber * (lastNumber + 1)) / 2;
var actualSum = 0;
// Show the difference
for (var i = 0; i < numbers.length; i++) {
@amaxwell01
amaxwell01 / os-ticks
Created June 25, 2013 17:58
OS Ticks
<section class="os-ticks">
<span class="os-tick dark_grey" style="left:-2%">4.1</span>
<span class="os-tick dark_grey" style="left:12%">4.2</span>
<span class="os-tick dark_grey" style="left:26%">4.3</span>
<span class="os-tick dark_grey" style="left:41%">5.0</span>
<span class="os-tick dark_grey" style="left:55%">5.0.1</span>
<span class="os-tick dark_grey" style="left:69%">5.1</span>
<span class="os-tick dark_grey" style="left:84%">5.1.1</span>
<span class="os-tick dark_grey" style="left:98%">6.0</span>
</section>
@amaxwell01
amaxwell01 / resize_delay.js
Created December 3, 2012 23:52
window resize delay
// Run code on resize, but give it a slight delay so that we aren't always calculating it
$(window).resize( function() {
if( timer ) {
clearTimeout(timer);
}
var timer = setTimeout( function() {
// On Resize Code Goes Here
}, 100 );
@amaxwell01
amaxwell01 / ellipsis.js
Created December 1, 2012 23:40
General Ellipsis Script
/* ==========================================================================
Ellipsis
* @params : item : Gets the ID of the element that you want to ellipsis
* the text in item can also be overloaded, it can be a string as well, in
* which case if it is long enough it will return the string with the
* ellipsed ammount.
* @params : amount : The number of characters that you want to include
========================================================================== */
var ellipsis = function( item, amount ) {
@amaxwell01
amaxwell01 / index.html
Created November 26, 2012 18:48
A CodePen by Andrew Maxwell.
<div class="fake_background">
<!-- Editable Dropdown -->
<div id="kind">
<div id="current_selection" class="kind_selection">:nth-child</div>
<div id="kind_arrow" class="selection_arrows">
<span class="top_arrow">▲</span>
<span class="bottom_arrow">▼</span>
</div>
<ul id="kind_options" class="selection_options">
<li data-value=":nth-child" class="selected">:nth-child</li>
@amaxwell01
amaxwell01 / index.html
Created November 26, 2012 18:48
A CodePen by Andrew Maxwell.
<div class="fake_background">
<!-- Editable Dropdown -->
<div id="kind">
<div id="current_selection" class="kind_selection">:nth-child</div>
<div id="kind_arrow" class="selection_arrows">
<span class="top_arrow">▲</span>
<span class="bottom_arrow">▼</span>
</div>
<ul id="kind_options" class="selection_options">
<li data-value=":nth-child" class="selected">:nth-child</li>
@amaxwell01
amaxwell01 / sidebar_height.js
Created November 26, 2012 07:35
Matching a sidebars height to the content
var correctSidebarBorderHeight = function() {
var sidebar = $('.sidebar');
var sidebarHeight = sidebar.height();
var content = $('.body_content');
var contentHeight = content.height();
if( sidebarHeight < contentHeight ) {
sidebar.css('height', contentHeight);
}
};
@amaxwell01
amaxwell01 / colors.scss
Created November 21, 2012 00:57
My Favorite Colors
$green = #20BF00;
$green = rgba(32, 191, 0, 0);
$blue = #1E6CBF;
$blue = rgba(30, 108, 191, 0);