Skip to content

Instantly share code, notes, and snippets.

Doug Niccum dniccum

Block or report user

Report or block dniccum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dniccum
dniccum / SecureInput.js
Created Oct 4, 2018
A Vue.JS directive that toggles the input type from text to password on blur; creating a secure input.
View SecureInput.js
import Vue from 'vue';
Vue.directive('secure-input', {
inserted(el) {
el.type = 'password';
},
bind(el) {
el.addEventListener('focus', () => {
el.type = 'text'
});
@dniccum
dniccum / FizzBuzz.py
Created Feb 24, 2018
A basic Python application called FizzBuzz
View FizzBuzz.py
for x in range(1, 101):
if x % 3 == 0 and x % 5 != 0:
print "Fizz"
elif x % 5 == 0 and x % 3 != 0:
print "Buzz"
elif x % 5 == 0 and x % 3 == 0:
print "FizzBuzz"
else:
print x
@dniccum
dniccum / ErrorService.js
Last active Feb 29, 2016
A custom error reporting workflow for SailsJS that uses AngularJS and the NodeJS package sails-hook-validation
View ErrorService.js
module.exports = {
ParseUserErrors: function(errors) {
var validationErrors = [];
for (var key in errors) {
if (errors.hasOwnProperty(key)) {
for (var item in errors[key]) {
if (errors[key][item].rule !== "string") {
validationErrors.push(errors[key][item].message);
}
@dniccum
dniccum / jQuery Counter
Last active Aug 29, 2015
A basic jQuery/Javascript counter to counts up to a certain number within a certain time period.
View jQuery Counter
// target: The jQuery/Javascript element that you want the function to affect
// targetNumber: The max number you want the counter to get to
// type: Type of units the function outputs; can be modifed
// currentNumber: The number you would like to start from; leave undefined to start from zero
function countUp(target, targetNumber, type, currentNumber) {
var integer,
interval = (3 / targetNumber) * 1000; // 3 is the amount of time to give the counter to reach its desired amount
if (currentNumber === undefined) {
@dniccum
dniccum / _variables.scss
Last active Aug 29, 2015
This is my basic boilerplate of SCSS mixins that I have been compiling
View _variables.scss
// MIXINS
@mixin shadow($color: #B8B8B8) {
-webkit-box-shadow: 0 0 10px 2px $color;
box-shadow: 0 0 10px 2px $color;
}
@mixin gradient($color1, $color2) {
background: $color1;
background: -moz-linear-gradient(top, $color1 0%, $color2 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$color1), color-stop(100%,$color2));
You can’t perform that action at this time.