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 / update_hosts.sh
Created November 11, 2013 08:25
Update /etc/hosts file, for edding virtualhosts in ~/public_html
#!/bin/bash
HOSTS='/etc/hosts';
TMP='hosts'
cat $HOSTS | grep -vE '127' > $TMP
ls -d1 */ | awk '{ ORS=" "; print; }' | sed "s/\///g;s/^/127.0.0.1 localhost `hostname` /g" >> $TMP
sudo mv $TMP $HOSTS
@iegik
iegik / plsql.md
Last active December 27, 2015 18:09

Syntax

SELECT 'aaa '' bbb' from dual --> aaa ' bbb

Enable I/O

BEGIN
    DBMS_OUTPUT.ENABLE (buffer_size => NULL);
    DBMS_OUTPUT.put_line('Text,'||999);

END;

@iegik
iegik / upload.js
Created July 28, 2013 10:29
Both: drag-n-drop and old-style upload form.
"use strict";
/*\
|*|
|*| :: XMLHttpRequest.prototype.sendAsBinary() Polifyll ::
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#sendAsBinary()
\*/
if (!XMLHttpRequest.prototype.sendAsBinary) {
@iegik
iegik / utils.sql
Last active December 19, 2015 04:49
CREATE OR REPLACE TYPE ARRAY AS TABLE OF CLOB;--VARCHAR2(32760);
/
-- Required: TYPE ARRAY AS TABLE OF VARCHAR2(1000)
CREATE OR REPLACE PACKAGE UTILS IS
SUBTYPE MEMO IS CLOB;--VARCHAR2(32760);
FUNCTION SPLIT(pattern CLOB, replacement CLOB) RETURN ARRAY;
END UTILS;
/
CREATE OR REPLACE PACKAGE BODY UTILS IS
-- Simple package with BDD
CREATE OR REPLACE PACKAGE simple_package IS
--
PROCEDURE BDD_example (
BDD ARRAY
);
END;
/
CREATE OR REPLACE PACKAGE BODY simple_package IS
PROCEDURE BDD_example (
@iegik
iegik / README.md
Last active October 24, 2025 13:50
Collection of Regular Expressions
  • [\p{IsCyrillic}]+, [а-яА-ЯёЁ]+ - Cyrillic words
  • ^[\s\t]+?(font|background|border|link|vlink|color)(-\w+)?:.*$ - CSS property lines
@iegik
iegik / jsFiddle.html
Last active December 12, 2015 04:38
jsFiddle - good service, but... internet connection sometimes goes down, or simply server not respond. So, I create fast alternative for my favorite service, where I can play with fiddles locally. It uses localStorage, for savings.
<!DOCTYPE html>
<html>
<head>
<style>
body,html,form{height:100%;width:100%;
margin:0;
padding:0;
background-color: rgba(255,255,255,.5);
color: #222;
@iegik
iegik / dropfont.js
Last active December 12, 2015 03:28
var doc = document.documentElement;
doc.ondragover = function () {
//this.className = 'hover';
return false;
};
doc.ondragend = function () {
//this.className = '';
return false;
};
doc.ondrop = function (event) {
@iegik
iegik / mage777.sh
Last active July 26, 2024 07:54
Make Magento Template Path Hints hidden, to not distroy page layout
#!/bin/bash
find . -type d -exec chmod 777 {} \;
find . -type f -exec chmod 644 {} \;
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx *
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx *
@iegik
iegik / noized.js
Last active October 13, 2015 22:48
Replace broken images with noise
HTMLCanvasElement.prototype.addNoise = function(r, g, b, a, l) {
// default variables: red, green, blue, alpha, light
a||(a=-.4);
l||(l=.5);
//(!red&&green)||(alpha=green,green=128);
//(!green&&blue)||(brightness=blue,blue=128);
r||(r=1);
g||(g=1);
b||(b=1);