Skip to content

Instantly share code, notes, and snippets.

@metude
metude / random-tc-number.js
Created April 1, 2014 00:08
Rastgele TC Kimlik No Javascript
var num = Math.floor((Math.random()*999999999)+100000000);
console.log("random number: " + num);
var str = num.toString();
var num_array = str.split("");
console.log("number array: " + num_array);
function interesting_rule(num_array) {
var sum_even = parseInt(num_array[1]) + parseInt(num_array[3]) + parseInt(num_array[5]) +parseInt(num_array[7]);
var sum_odd = parseInt(num_array[0]) + parseInt(num_array[2]) + parseInt(num_array[4]) +parseInt(num_array[6]) + parseInt(num_array[8]);
return ((sum_odd*7)-sum_odd)%10;
@metude
metude / background.js
Created November 28, 2012 11:47
Opera Extension - Download Chrome
window.addEventListener('DOMContentLoaded', function() {
if (opera.contexts.menu) { // Check the Context Menu API is supported
var menu = opera.contexts.menu; // Create a menu item properties object
var itemProps = {
contexts: ['page', 'link'],
icon: 'images/chrome.png',
documentURLPatterns: [
'http://chrome.google.com/webstore/*',
'https://chrome.google.com/webstore/*'
@metude
metude / gist:4347001
Created December 20, 2012 17:31
Simple Font Detect with JS (source: http://my.opera.com/QuHno/ )
/*********************** Fontdetect - The font stuff - START ********************/
var font = document.getElementById('font'); // The hidden input field
var output = document.getElementById('output'); // the detected font results go here
var fontList =''; // the result
var computed = window.getComputedStyle(output, null); // the actual style of the tested element