Skip to content

Instantly share code, notes, and snippets.

View hmert's full-sized avatar
🎃
fintech

Hüseyin Mert hmert

🎃
fintech
View GitHub Profile
// ikilemeleri yok ediyorum böylece
function replaceDups(field) {
field = field.replace(/\s(\w+\s)\1/, " $1");
return field;
}
<?php
// en basit php proxy
$url = $_GET['url'];
header('Content-type: text/plain');
echo file_get_contents($url);
// rastgele rakamlı harfli değer üretir.
var randomString = function(numchars) {
var chars = "0123456789ABCDEFGHJKMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz";
var randomstring = '';
for (var i=0; i<numchars; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
return randomstring;
};
#! /bin/bash
# ubuntu'da vorbis-tools ve mplayer yuklu olmalidir
echo "Bu bash kod ile tum mp3leriniz converted klasorune ogg olarak donusturulur"
mkdir converted
for i in *.mp3; do
mv "$i" `echo $i | tr ' ' '_'`
echo $i
/**
* rating password by Google
*
* @author hatem <huseyin@hmert.com>
* @param password the password to rate by google.
* @return rate
* @return string
*/
function ratePass($password) {
// url encoding
utfTools.prototype.encode = function (string) {
return escape(this._utf8_encode(string));
}
// url decoding
utfTools.prototype.decode = function (string) {
return this._utf8_decode(unescape(string));
}
/*
jQuery Form resetleyici
*/
$.fn.clearForm = function () {
return this.each(function () {
$('input,select,textarea', this).clearFields();
});
};
$.fn.clearFields = $.fn.clearInputs = function () {
return this.each(function () {
@hmert
hmert / gist:732236
Created December 7, 2010 19:10 — forked from remy/gist:333954
// pure JS
function shuffle(array) {
return array.sort(function(){
return .5 - Math.random();
});
}
// with Prototype.js you can do
function shuffle(array){
return array.sortBy(Math.random);
@hmert
hmert / gist:733921
Created December 8, 2010 21:13 — forked from defunkt/gist:3124
(function($) {
////
//
// Depends on the amazing Ajax form plugin.
//
// Callback receives responseText and 'success' / 'error'
// based on response.
//
// i.e.:
// $('#someform').spamjax(function(text, status) {