Skip to content

Instantly share code, notes, and snippets.

View alioguzhan's full-sized avatar
there is no dark side in the moon, really.

Ali Oguzhan Yildiz alioguzhan

there is no dark side in the moon, really.
View GitHub Profile
// Validate Phone Format
var filter = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
// Validate Email Format
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/;
// Validate Date Format (Short Date mm/dd/yyyy)
var filter = /^(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])\/(?:19|20|21\d{2})/;
alioguzhan / toObject.js
Last active December 24, 2015 02:29
convert an 'array' which includes multiple (different) objects as element into 'one object'.
var toObject = function(obj){
var newObj = {};
for(var i = 0; i<obj.length; i++){
for(var k in obj[i]){
if(obj[i].hasOwnProperty(k)) {
newObj[k] = obj[i][k];
return newObj;
<!DOCTYPE html>
<script src=""></script>
<script src=""></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<div class="cardRates">
(defn handle-register [username email pass1 pass2]
(if(has-values?[username email pass1 pass2])
(json {:resp "Please fill all fields."}))
(if(not(= pass1 pass2))
(json {:resp "Passwords dont match."}))
(if(not(nil?(db/get-user-by-username username)))
(json {:username "This username already exists."}))
alioguzhan / convert_to_ascii
Created November 16, 2013 14:36
Takes a string as param, and convert all turkish (non-ascii) chars to ascii.
def get_ascii_name(name):
""" returns a non-ascii -turkish- string to ascii one """
name = name.lower()
map = {u"ı": "i",
u"ğ": "g",
u"ç": "c",
u"ü": "u",
u"ö": "o",
u"ş": "s"}
uname = []
td {
background: red;
padding-left: 5px;
padding-right: 5px;
color: white;
font-size: 20px;
font-weight: bold;
width: 40px;
height: 60px;
text-align: center;
alioguzhan /
Created May 19, 2016 12:56
Bash script to create gif from vide with ffmpeg
ffmpeg -v error -ss $1 -t $2 -i $3 -vf "$filters,palettegen" -y $global_palette
ffmpeg -v error -ss $1 -t $2 -i $3 -i $global_palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $4
alioguzhan /
Created February 9, 2017 12:03 — forked from DanyHenriquez/
Disable tracker Ubuntu 16.04
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-extract.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-apps.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-fs.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-user-guides.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-store.desktop
gsettings set org.freedesktop.Tracker.Miner.Files crawling-interval -2
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false
tracker reset --hard
alioguzhan /
Created April 26, 2017 13:04
React-Native Cleaner Script
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
echo -e "Cleaning ${Yellow}\$TMPDIR${Reset}..."
rm -fr $TMPDIR/react* ;
echo -e "${Green}Done."
echo -e "${Reset}Cleaning ${Yellow}watchman cache${Reset}...";