Skip to content

Instantly share code, notes, and snippets.

View maryleloisa's full-sized avatar
🦁

Maryll Eloisa maryleloisa

🦁
View GitHub Profile
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}
};
'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'),
$ease-in-out: ease-in-out;
$wait: 1000ms;
$stagger: 80ms;
$duration: 2000ms;
.cs-loader {
color: $color-pink;
text-align: center;
}
@maryleloisa
maryleloisa / find-undefined-css-rules.js
Last active January 7, 2016 22:36 — forked from kdzwinel/main.js
List all undefined CSS classes
/*
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.
@maryleloisa
maryleloisa / bs-breakpoint-viewer.js
Last active December 6, 2015 12:30
Bootstrap breakpoints viewer js
$('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>');
@maryleloisa
maryleloisa / random-interval.js
Created November 9, 2015 08:37
random interval ticker
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));
}
<?php
function isDeniedISP($isp)
{
$deniedList = ['amazon', 'bamazon'];
foreach ($deniedList as $keyWord) {
if (stripos($isp, $keyWord) !== false) {
return true;
}
}
@maryleloisa
maryleloisa / touchmouse.js
Created September 30, 2015 10:10 — forked from roboshoes/touchmouse.js
This snippet maps mouse events and touch events onto one single event. This makes it easier in the code since you have to listen to only one event regardles whether it's desktop or mobile.
(function() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */
@maryleloisa
maryleloisa / underscore_conditionals.js
Last active September 18, 2015 09:15 — forked from brianarn/underscore_conditionals.js
Conditionals with underscore.js
// 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 %> <% } %>");
@maryleloisa
maryleloisa / index.html
Last active September 4, 2015 06:41
Underscore.js Demo - Run Fiddle at http://jsfiddle.net/binarychef/BL3rj/4/
<html>
<head>
<title></title>
<style type="text/css">
#output {
font-family: Courier;
font-size: 12px;
}
</style>
</head>