Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🏠
Working from home

Arturs Jansons iegik

🏠
Working from home
View GitHub Profile
@iegik
iegik / marker.html
Created October 17, 2010 09:46
Adding "marker" effect to span, strong and whatever tags...
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Marker</title>
<meta name="author" content="Arturs Jansons">
<!-- Date: 2010-10-16 -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
$(function(){
@iegik
iegik / sudoku.html
Last active January 27, 2021 09:51
<script>window.ready=function(){var e;e=!1;return function(d){var a,c;c=function(){if(!e)return e=!0,d()};a=function(){try{document.documentElement.doScroll("left")}catch(b){return setTimeout(a,1),null}return c()};if(document.readyState==="complete")return c();if(document.addEventListener)return document.addEventListener("DOMContentLoaded",c,!1),window.addEventListener("load",c,!1);else if(document.attachEvent&&(document.attachEvent("onreadystatechange",c),window.attachEvent("onload",c),(typeof document===
"undefined"||document===null?0:document.documentElement==null?0:document.documentElement.doScroll)&&(typeof window==="undefined"||window===null?void 0:window.frameElement)===null))return a()}}();
ready(function(){function e(c,b){for(x in a)if(x>c-x%9&&a[x]==b||a[x%9]==b||a[x%9+9]==b||a[x%9+18]==b||a[x%27-x%3+1]==b||a[x%27-x%3+2]==b||a[x%27-x%3+3]==b||a[x%27-x%3+10]==b||a[x%27-x%3+11]==b||a[x%27-x%3+12]==b||a[x%27-x%3+19]==b||a[x%27-x%3+20]==b||a[x%27-x%3+21]==b)b=0;a+=""+b}var d,a="";for(d=1;d<=81;d++)e(d,M
@iegik
iegik / mysql_alter.sh
Last active January 27, 2021 07:33
Scripts for manage SQL files - useful for VCS. NOTE: Use mysql_create.sh to create working set of sql files before
#!/bin/bash
# Alter selected table by differance between shemas
shema1=$1
shema2=$2
echo "" > sql/$shema1"-alter.sql"
for table in $(echo "show tables" | mysql -uroot $shema1 | tail -n +2 )
do
diff sql/$shema1/$table"-create.sql" sql/$shema2/$table"-create.sql" | grep -e '^> \W' | sed 's/^>/ALTER TABLE `'$table'` ADD /g;s/\s*,$/;/g' > sql/$shema1/$table"-alter-add.sql"
cat sql/$shema1/$table"-alter-add.sql" >> sql/$shema1"-alter.sql"
@iegik
iegik / ci.sh
Last active January 27, 2021 09:09
Create new CodeIgniter project
#!/bin/sh
# Creates new CodeIgniter project
if [ $1 ]; then
mkdir -p ./$1
ln -s ~/public_html/codeigniter/system/ ./$1/system
cp -r ~/public_html/codeigniter/app/ ./$1/app
cp ~/public_html/codeigniter/index.php ./$1
sed 's/RewriteBase \/~.*/RewriteBase \/~'`whoami`'\/'$1'/' ~/public_html/codeigniter/.htaccess > ./$1/.htaccess
sed 's/.base_url.*/"base_url"] = "http:\/\/'`hostname`'\/~'`whoami`'\/'$1'\/";/' ./codeigniter/app/config/config.php > ./$1/app/config/config.php
echo "You can see Your page on \"http://`hostname`/~`whoami`/$1\""
@iegik
iegik / sf-clean.sh
Last active January 27, 2021 09:33
Creates default Simfony`s file structure and new database
## Symfony2
## Clear Cache
rm -rf app/cache/*
rm -rf app/logs/*
@iegik
iegik / run.php
Last active May 31, 2023 16:28
PHP Interactive Mode (not secure)
<?php
function error($e)
{
switch($e['type'])
{
case E_ERROR: // 1 //
return '<div class="alert alert-error"><a class="close" data-dismiss="alert" href="#">&times;</a><p><i class="icon-code icon-cog"></i>'.$e['message'].' on line '.$e['line'].'</p></div>';
case E_WARNING: // 2 //
return '<div class="alert alert-warning"><a class="close" data-dismiss="alert" href="#">&times;</a><p><i class="icon-code icon-cog"></i>'.$e['message'].' on line '.$e['line'].'</p></div>';
case E_PARSE: // 4 //
@iegik
iegik / how_many_days_pass.php
Last active September 27, 2015 15:17
Cik dienas pārgaja? Сколько дней прошло? http://translate.sourceforge.net/wiki/l10n/pluralforms
<?=(@$days=intval((time()-strtotime("15.10.2011"))/86400))?"Pirms ".$days.((substr($days,-1)==1&&substr($days,-2)!=11)?" dienas":" dienām"):"Šodien";?>
<?=(@$days=intval((time()-strtotime("15.10.2011"))/86400))?$days.((substr($days,-1)&&substr($days,-1)>4)?" дней":(substr($days,-1)==1?" день":" дня"))." назад":"Сегодня";?>
@iegik
iegik / normalize.js
Last active February 28, 2018 09:08
Replace āēūīšģķļ to aeuisgkl
// shim for String.prototype.normalize https://github.com/walling/unorm
export default str => str.normalize('NFKD')
.replace(/[\u0300-\u036f]/g, "") // remove accents
.replace(/\u0142/g, "l"); // ł is a letter in itself
/*
const normalize = import('normalize.js')
console.log(normalize('ąśćńżółźćęāēūīšģķļ'))
*/
@iegik
iegik / nautilus2thunar.sh
Created February 16, 2012 22:37
Switch from Nautilus to Thunar file manager
#!/bin/bash
## Originally written by aysiu from the Ubuntu Forums
## This is GPL'ed code
## So improve it and re-release it
## Define portion to make Thunar the default if that appears to be the appropriate action
makethunardefault()
{
## I went with --no-install-recommends because
@iegik
iegik / cheatsheet.js
Created February 19, 2012 18:24
JavaScript console cheatsheet
var d=document,
w={
'window':0,'d':0,'d.forms':0,
'form':1,'input':1,'table':1,'a':1,
'/./':0,'!1':0,'0xf0':0,'070':0,'0.90':0,'""':0,"''":0,'Array()':0,'Math':0
}
for(k in w){
if(w[k])
k = d.createElement(k);
v=eval(k);