Skip to content

Instantly share code, notes, and snippets.

View smddzcy's full-sized avatar

Samed Düzçay smddzcy

View GitHub Profile
objToFormData = (obj, formData, prefix) ->
formData ?= new FormData
formKey = null
angular.forEach obj, (val, key) ->
if prefix?
formKey = "#{prefix}[#{key}]"
else
formKey = key
@smddzcy
smddzcy / .htmlhintrc
Created June 12, 2016 14:16 — forked from DrummerHead/.htmlhintrc
HTMLHint rules
{
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"attr-value-not-empty": true,
"attr-no-duplication": true,
"doctype-first": false,
"tag-pair": true,
"tag-self-close": false,
"spec-char-escape": true,
@smddzcy
smddzcy / disableLogs-linux.sh
Created October 26, 2015 21:23
Delete & disable logs on Linux
#!/bin/bash
#delete bash logs & disable logging on linux
export HISTFILE=/dev/null;
export HISTSIZE=0;
rm ~/.bash_history -rf;
history -c;
@smddzcy
smddzcy / _exec.php
Created October 4, 2015 14:59
System command execute function, tries a bunch of funcs
/**
* @param string $cmd Command to execute
* @return string Result
*/
public function _exec($cmd)
{
$res = '';
if (!empty($cmd)) {
if (@function_exists('exec')) {
exec($cmd, $res);
@smddzcy
smddzcy / regexp_last30days_oneliner.php
Last active October 1, 2015 09:27
One line regExp date builder for last 30 days in PHP. Doesn't match dates with ':' delimiter; since they are obviously "hours", not "dates" ._.
$regexpLastThirty = '#' . '(' .
/*
* regExp builder for this month
* d-m-Y m-d-Y Y-d-m Y-m-d
* d-m-y m-d-y y-d-m y-m-d
*/
implode('|', array_map(function ($v) {
return
'(' . str_pad($v, 2, 0, STR_PAD_LEFT) . '[^:]?' . str_pad(date('m'), 2, 0, STR_PAD_LEFT) . '[^:]?' . date('Y') . ')'
. '|' . '(' . str_pad(date('m'), 2, 0, STR_PAD_LEFT) . '[^:]?' . str_pad($v, 2, 0, STR_PAD_LEFT) . '[^:]?' . date('Y') . ')'