Skip to content

Instantly share code, notes, and snippets.

View nasal's full-sized avatar

Rudi Kovač nasal

View GitHub Profile
@nasal
nasal / slovenskamesta.html
Last active August 29, 2015 14:02
HTML: Slovenska mesta
<select name="mesto">
<option>
Izberi
</option>
<option value="Adlešiči">
Adlešiči
</option>
<option value="Ajdovščina">
@nasal
nasal / slevenskeregije.html
Last active August 29, 2015 14:02
HTML: Slovenske regije
<select name="regija">
<option>
Izberi
</option>
<option value="gorenjska">
Gorenjska regija
</option>
<option value="goriska">
Goriška regija
</option>
@nasal
nasal / slovenskeobcije.html
Last active August 29, 2015 14:02
HTML: Slovenske občine
<select name="obcina">
<option>
Izberi
</option>
<option value="192">
Ajdovščina
</option>
<option value="205">
Ankaran
</option>
@nasal
nasal / mb_ucwords.php
Created March 6, 2014 10:06
PHP: mb_ucwords
<?php
if (!function_exists('mb_ucwords'))
{
function mb_ucwords($str)
{
return mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
}
}
?>
@nasal
nasal / newfile.tex
Last active August 29, 2015 13:57
LaTeX: starter document
% -*- coding: utf-8 -*-
\documentclass[a4paper]{article}
\usepackage[slovene]{babel} % šumniki s \v{c}
\usepackage[utf8]{inputenc} % šumniki s č
\usepackage{mathtools} % za matematiko
\usepackage{amssymb} % za dodatne simbole, \mathbb{F, R, N..}
\title{My Title}
\author{My Name}
@nasal
nasal / touch.js
Created February 13, 2014 00:12 — forked from rogeruiz/touch.js
JS: handle touch events on multiple devices
function handleTouch (evt) {
var touchX, touchY, xOffset, yOffset;
if (window.navigator.msPointerEnabled) {
var bodyEl = document.getElementByTagName('body')[0];
bodyEl.style.msTouchAction = 'none';
bodyEl.style.touchAction = 'none';
}
// Normalize your touch events
touchX = evt.originalEvent.pageX || evt.originalEvent.changedTouches[0].screenX;
touchY = evt.originalEvent.pageY || evt.originalEvent.changedTouches[0].screenY;
@nasal
nasal / wp8-responsive.js
Created January 17, 2014 09:53
JS: WP8 IE responsive hack
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(
document.createTextNode(
"@-ms-viewport{width:auto!important}"
)
);
document.getElementsByTagName("head")[0].
appendChild(msViewportStyle);
}
@nasal
nasal / .htaccess
Created January 15, 2014 07:17
Apache: remove .php extension from url
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
@nasal
nasal / changepiece.php
Created December 25, 2013 15:27
PHP: Change a piece of the URL
function changepiece($parameter, $value)
{
$params = array();
$output = "?";
$firstRun = true;
foreach($_GET as $key=>$val)
{
if($key != $parameter)
{
if(!$firstRun)
@nasal
nasal / logout.php
Last active December 27, 2015 09:59
PHP: logout
<?php
if (isset($_GET['logout'])) {
session_start();
session_unset();
session_destroy();
session_write_close();
setcookie(session_name(),'',0,'/');
session_regenerate_id(true);
header('location: ./');
}