Skip to content

Instantly share code, notes, and snippets.

View cmchase's full-sized avatar

Cory Chase cmchase

  • Citrix
  • Raleigh, North Carolina
View GitHub Profile
Even or Odd
https://www.codewars.com/kata/even-or-odd/train/javascript
Get Middle Character
https://www.codewars.com/kata/get-the-middle-character/train/javascript
Multiples of 3 or 5
https://www.codewars.com/kata/multiples-of-3-or-5/train/javascript
Valid Parentheses
@cmchase
cmchase / preventAbandonment
Created September 1, 2013 04:59
Prevent a user from accidentally leaving a content area with unsaved changes. Init accepts the content area we want to watch changes within as well as the save button that will commit the changes.
var ns = ns || function () {
var self = {}; // required to access public functions/variables
return {
initNS: function () { self = this; return this; },
///////////////////////////////////////////////////////////
// Page State
@cmchase
cmchase / gradient-mixins
Created September 1, 2013 04:57
Bootstrap v3 Gradient Mixins. Drop this wherever your overrides are. It reuses the namespace to make usage more consistent.
#gradient {
.vertical-alpha(@start-color: #555; @start-alpha: 0; @start-percent: 0%; @end-color: #333; @end-alpha: 1; @end-percent: 100%) {
background-color: transparent !important;
@start-alpha-color: hsla(hue(@start-color), saturation(@start-color), lightness(@start-color), 0);
@end-alpha-color: hsla(hue(@end-color), saturation(@end-color), lightness(@end-color), @end-alpha);
#gradient .vertical(@start-alpha-color; @start-percent; @end-alpha-color; @end-percent);
}
.horizontal-three-colors-alpha(@start-color: #00b3ee; @start-alpha: 1; @mid-color: #7a43b6; @mid-alpha: 1; @color-stop: 50%; @end-color: #c3325f; @end-alpha: 1;) {
background-color: transparent !important;
@cmchase
cmchase / gradient-mixins
Last active December 20, 2015 02:19
Bootstrap v2 Mixins for gradients with alpha transparencies. These go in the existing #gradient namespace in mixins.less and assume that the both the .vertical and .vertical-three-color mixins are present.
.vertical-alpha(@startColor: #555, @startAlpha: 1, @endColor: #333, @endAlpha: 1) {
@startAlphaColor: hsla(hue(@startColor), saturation(@startColor), lightness(@startColor), @startAlpha);
@endAlphaColor: hsla(hue(@endColor), saturation(@endColor), lightness(@endColor), @endAlpha);
.vertical(@startAlphaColor, @endAlphaColor);
}
.vertical-three-colors-alpha(@startColor: #00b3ee, @startAlpha: 1, @midColor: #7a43b6, @midAlpha: 1, @colorStop: 50%, @endColor: #0026ff, @endAlpha: 1) {
@startAlphaColor: hsla(hue(@startColor), saturation(@startColor), lightness(@startColor), @startAlpha);
@midAlphaColor: hsla(hue(@midColor), saturation(@midColor), lightness(@midColor), @midAlpha);
@endAlphaColor: hsla(hue(@endColor), saturation(@endColor), lightness(@endColor), @endAlpha);
.vertical-three-colors(@startAlphaColor, @midAlphaColor, @colorStop, @endAlphaColor);