Skip to content

Instantly share code, notes, and snippets.

View antistereotip's full-sized avatar

Milutin Gavrilović antistereotip

View GitHub Profile
@antistereotip
antistereotip / menu-to-select
Last active August 29, 2015 14:19
Classic menu to Select Dropdown
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Convert Menu to Dropdown</title>
<style>
* {
index.php
--------------------------------------------------------------------------------------------------------
<?php
$page = 'pages/'.$_GET[id].'.php';
(!file_exists($page) == 0) ? require_once $page : require_once 'pages/home.php';
?>
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
@antistereotip
antistereotip / promeni-php-ini.sh
Created June 18, 2015 21:05
promena php.ini file parametra
#!/usr/bin/env bash
upload_max_filesize=240M
post_max_size=50M
max_execution_time=100
max_input_time=223
for key in upload_max_filesize post_max_size max_execution_time max_input_time
do
sed -i "s/^\($key\).*/\1 $(eval echo \${$key})/" php.ini
@antistereotip
antistereotip / paginacija.php
Last active September 16, 2015 16:21
prosta paginacija po dva broja iz niza
<?php
function paginate($a,$b=1,$c=5){$d=(($b*$c)-$c)+1;$e=$b*$c;
$f=1;$g=array();foreach($a as $h){if($f>=$d&&$f<=$e){$g[]=$h;}$f++;}
$i=ceil(count($a)/$c);return array('page_data'=>$g,'pages'=>$i,'page'=>$b);}
$data = array(1,2,3,4,5,6,7,8,9,10,11,12,13);
//get page 2 data, 4 items per-page
$page_info = paginate($data,2,4);
print_r($page_info);
@antistereotip
antistereotip / putenv.php
Created June 18, 2015 21:09
promena okruzenja php-om
<?php
$saved = getenv("LD_LIBRARY_PATH"); // save old value
$newld = "/extra/library/dir:/another/path/to/lib"; // extra paths to add
if ($saved) { $newld .= ":$saved"; } // append old paths if any
putenv("LD_LIBRARY_PATH=$newld"); // set new value
system("mycommand -with args"); // do system command;
// mycommand is loaded using
// libs in the new path list
putenv("LD_LIBRARY_PATH=$saved"); // restore old value
?>
<?php
//https://css-tricks.com/css-variables-with-php/
?>
<!-- http://www.weberdev.com/get_example.php3?ExampleID=3766 -->
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="newuser.php">
<p>Login:
<input name="login" type="text" id="login">
@antistereotip
antistereotip / pretrazi-eregi.php
Created June 19, 2015 21:14
jednostana funkcija za pretragu stringa
<form>
<input name="pretrazi" method="get" type="search" class="" placeholder=" Search... " autofocus>
<input type="submit" value="ENTER" class="button">
</form>
<?php
$pretrazi = $_GET['pretrazi'];
$sta_pretrazujemo = 'antistereotip apache c cherokee commandlinefu css3 debian fewona filmovionline fsf gaddafi gnu gwan hightech html5 irc kgb libre linog linux linuxzasve lisp ludus mongodb mysql nemysis neo4j ng1np nginx nginz oklop php popivoda postgresql profi python routefor sceko slackware-srbija sql unix videoteka webserveri wideip zaneupucene zdroid zdroidblog zpop';
$rezultat = eregi($pretrazi,$sta_pretrazujemo);
if ($rezultat){ echo 'True, <b style="color:green">'.$pretrazi.'</b> je pronadjen!'; }
@antistereotip
antistereotip / pozicija-kursora.php
Created June 19, 2015 21:17
javascript pozicija kursora
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction(e)
{
x=e.clientX;
y=e.clientY;
coor="Coordinates: (" + x + "," + y + ")";
document.getElementById("demo").innerHTML=coor
# nano /etc/vsftpd.conf
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
# local_umask=022
# anon_upload_enable=YES
# anon_mkdir_write_enable=YES
dirmessage_enable=YES