Skip to content

Instantly share code, notes, and snippets.

View risingsunomi's full-sized avatar
🏠
Working from home

Vincent risingsunomi

🏠
Working from home
View GitHub Profile
@DiegoSalazar
DiegoSalazar / validate_credit_card.js
Last active April 24, 2024 12:51
Luhn algorithm in Javascript. Check valid credit card numbers
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
anonymous
anonymous / index.html
Created December 28, 2014 06:42
myrjqv
<div class="container-fluid">
<div class="row">
<div class="col-lg-8 col-sm-8 col-12">
<form method="POST" action=".">
<h4>Upload Prospects</h4>
<div class="form-group">
<span class="input-group-btn">
<span class="btn btn-primary btn-file">
Browse&hellip; <input type="file">
</span>
@0x263b
0x263b / colors.md
Last active July 13, 2024 19:15
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@abel0b
abel0b / appdata.c
Created November 23, 2020 19:09
Get AppData Roaming folder in C C++
// how to locate application data %AppData% directory path on Windows 10 MSVC
// see on documentation https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath?redirectedfrom=MSDN
// compiled with cl .\appdata.c Shell32.lib
#include <stdlib.h>
#include <stdio.h>
#include <shlobj_core.h>
#include <direct.h>
int main() {