Skip to content

Instantly share code, notes, and snippets.

View alexsasharegan's full-sized avatar

Alex Regan alexsasharegan

View GitHub Profile
@alexsasharegan
alexsasharegan / luhn.js
Created July 28, 2017 20:43 — forked from ShirtlessKirk/luhn.js
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@alexsasharegan
alexsasharegan / upload.php
Created August 19, 2017 04:31
Ghetto php upload script.
<?php
header( 'Content-Type: application/json; charset=utf-8' );
try
{
// Undefined | Multiple Files | $_FILES Corruption Attack
// If this request falls under any of them, treat it invalid.
if (
@alexsasharegan
alexsasharegan / md-colors.json
Created August 23, 2017 17:52
Material Design colors with both hex & rgb as JSON.
{
"red": {
"50": {
"hex": "#ffebee",
"rgb": [
255,
235,
238
]
},
@alexsasharegan
alexsasharegan / md-colors.js
Created August 23, 2017 18:03
Material Design colors with both hex & rgb as an ES2015 Module.
export const red = {
"50": {
hex: "#ffebee",
rgb: [255, 235, 238]
},
"100": {
hex: "#ffcdd2",
rgb: [255, 205, 210]
},
"200": {
// Global definition style
Vue.component("my-div", {
functional: true,
render(createElement) {
return createElement("div")
}
})
// ES module style
export default {
export default {
functional: true,
render(createElement){
return createElement("h1", "Hello Vue!")
}
}
/**
* <h1>Hello Vue</h1>
*/
export default {
functional: true,
render(createElement){
return createElement(
"h1",
{ staticClass: "h1", class: ["d-inline-block", "my-3"] },
"Hello Vue!"
)
}
}
export default {
functional: true,
render(createElement){
return createElement(
"header",
{ staticClass: "my-header" },
[
createElement(
"h1",
{
export default {
functional: true,
props: {
level: {
type: [String, Number],
default: "1",
validator: x => ["1","2","3","4","5","6"].includes(String(x))
}
},
render(createElement, vNodeContext){
{
"types": {
"build": {
"description": "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
"title": "Builds"
},
"chore": {
"description": "Other changes that don't modify src or test files",
"title": "Chores"
},