Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🧾
Looking for work

Arturs Jansons iegik

🧾
Looking for work
View GitHub Profile
@iegik
iegik / bindmouseweel.js
Created April 24, 2012 06:22
Binding mouseweel event
/*
adds events to the mouse and left / right keys
http://brandonaaron.net/code/mousewheel/docs
*/
$(document).bind('mousewheel', function(e, delta) {
if(delta > 0) {
stopSlideshow();
rotateImages(0);
}
else {
@iegik
iegik / image.php
Last active October 2, 2015 00:27
make transparent image with text image.php/{title}-{width}x{height}-{hexcolor}.[png|jpeg|gif|webp|xbm|wbmp|gd|gd2]
<?php
/* Placehold transparent image
* image.php/{title}-{width}x{height}-{hexcolor}.[png|jpeg|gif|webp|xbm|wbmp|gd|gd2]
*
* @require: php_gd2,
*/
header('Last-Modified: ' . gmdate('D, d M Y H:i:s T', filemtime(__FILE__)));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
@iegik
iegik / style.scss
Created February 28, 2012 03:16
HTML5 Boilerplate feat. OOCSS Compass
/*
* HTML5 Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*
* Detailed information about this CSS: h5bp.com/css
*
* ==|== normalize ==========================================================
@iegik
iegik / code_hightlighter.js
Created February 20, 2012 09:51
JavaScript: Code hightlighter
/*
.js-type {font-weight:700}
.js-variable, .js-type{color: #228}
.js-keyword{color: #708}
.js-string {color:#a22}
.js-punctuation {color:#666}
.js-atom {color:#281}
.js-comment, .js-comment * {color: #A70!important}
*/
String.prototype.hightlight = function(){
@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);
@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 / 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 / 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 / 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 / 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/*