Skip to content

Instantly share code, notes, and snippets.

View miladkdz's full-sized avatar
🐛

Milad Karbasizadeh miladkdz

🐛
View GitHub Profile
@miladkdz
miladkdz / server.js
Created October 18, 2016 09:11
A simple nodeJS server with CORS support
//Lets require/import the HTTP module
const http = require('http');
const util = require('util')
//Lets define a port we want to listen to
const PORT = 8080;
//We need a function which handles requests and send response
function handleRequest(request, response) {
response.setHeader('Access-Control-Allow-Origin', '*');
@miladkdz
miladkdz / national-code-validation-jquery
Created February 17, 2015 08:58
Iranian National Code Validation in jQuery
function checkNC(code) {
var L = code.length;
if (L < 8 || parseInt(code, 10) == 0) return false;
code = ('0000' + code).substr(L + 4 - 10);
if (parseInt(code.substr(3, 6), 10) == 0) return false;
var c = parseInt(code.substr(9, 1), 10);
var s = 0;
for (var i = 0; i < 9; i++)
s += parseInt(code.substr(i, 1), 10) * (10 - i);
@miladkdz
miladkdz / flatuicolors.less
Created November 1, 2014 12:56
flatuicolors.com Colors as LESS variables
@midnight-blue: #2c3e50;
@peter-river : #3498db;
@belize-hole : #2980b9;
@turquoise : #1abc9c;
@emerland : #2ecc71;
@amethyst : #9b59b6;
@wetasphalt : #34495e;
@greensea : #16a085;
@nephritis : #27ae60;
@wisteria : #8e44ad;