This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currencyValidator = { | |
format: function (number, floats = 2) { | |
return (Math.trunc(number * 100) / 100).toFixed(floats) | |
}, | |
parse : function (newString, oldNumber) { | |
var CleanParse = function (value) { | |
return {value: value} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var WriteFilePlugin = require('write-file-webpack-plugin'); | |
const devServer = { | |
contentBase: path.resolve(__dirname, './app'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ease-in-out: ease-in-out; | |
$wait: 1000ms; | |
$stagger: 80ms; | |
$duration: 2000ms; | |
.cs-loader { | |
color: $color-pink; | |
text-align: center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets. | |
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there). | |
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ . | |
Known limitations: | |
- it won't be able to take into account some external stylesheets (if CORS isn't set up) | |
- it will produce false negatives for classes that are mentioned in the comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').prepend('' + | |
'<div style="background-color: firebrick;color:white;position: fixed;left: 20px;top:20px;z-index: 50000;padding: 5px;border: 1px solid #551414;border-radius: 3px;opacity: 0.7">' + | |
' <span class="hidden-sm-up">XS</span>' + | |
' <span class="hidden-md-up hidden-xs-down">SM</span>' + | |
' <span class="hidden-lg-up hidden-sm-down">MD</span>' + | |
' <span class="hidden-xl-up hidden-md-down">LG</span>' + | |
' <span class="hidden-lg-down">XL</span>' + | |
'</div>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = 0; | |
var final = 100; | |
function tick() { | |
count += Math.round(Math.random() * 5); | |
if (count >= final) { | |
count = final; | |
} else { | |
setTimeout(tick, Math.round(40 + Math.random() * 120)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isDeniedISP($isp) | |
{ | |
$deniedList = ['amazon', 'bamazon']; | |
foreach ($deniedList as $keyWord) { | |
if (stripos($isp, $keyWord) !== false) { | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
/* == GLOBAL DECLERATIONS == */ | |
TouchMouseEvent = { | |
DOWN: "touchmousedown", | |
UP: "touchmouseup", | |
MOVE: "touchmousemove" | |
} | |
/* == EVENT LISTENERS == */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A means of using underscore.js to do templates with conditionals | |
// Inside of underscore's template, it returns a function that uses | |
// 'with' on a variable named obj, and you can touch into that using | |
// inline JS and <% %> wrappers | |
// A template with conditional display of last names: | |
var good = _.template("Hello: <%= name %> <% if (obj.lastname) { %> <%= lastname %> <% } %>"); | |
// A template that tries to do that, but fails: | |
var bad = _.template("Hello: <%= name %> <% if (lastname) { %> <%= lastname %> <% } %>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<style type="text/css"> | |
#output { | |
font-family: Courier; | |
font-size: 12px; | |
} | |
</style> | |
</head> |
NewerOlder