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 / debug.php
Created December 4, 2012 13:06
Get classes, methods and it`s arguments
<?php
function get_func_argNames($funcName,$className=null) {
if($className){
$f = new ReflectionMethod($className,$funcName);
}else{
$f = new ReflectionFunction($funcName);
}
$result = array();
foreach ($f->getParameters() as $param) {
$result[$param->name] = $param->isOptional()?:'required';
@iegik
iegik / bookmarks.html
Last active March 31, 2020 10:06
Useful browser scripts in shortcuts
<a href="javascript:window.history.back();">←</a>
<a href="javascript:(function(){window.location.search+='&webm=1';})();">yt:h5v</a>
<a href="javascript:(function(h){var r=h.innerHTML.match(/<!--\[if\s(?:[^<]+|<(?!!\[endif\]-->))*<!\[endif\]-->/gim);for(x in r){h.innerHTML+=r[x].replace(/<!--.*>/,'');};})(document.getElementsByTagName('html')[0]);">use IE styles</a>
<a href="javascript:(function(tags){var tag,obj={},all=0;for ( key in tags){tag = (tags[key].tagName+'').toLowerCase();all++;obj[tag]++ || (obj[tag]=1);}console.log('Tags:',obj);alert(all)})(document.getElementsByTagName('*'));">count html tags on page</a>
<a href="javascript:(function(b,w,h){b.style.width=w;b.style.height=h;b.style.overflow='hidden';})(document.getElementsByTagName('body')[0],'340px','640px')">iPhone</a>
<a href="javascript:(function(b,w,h){b.style.width=w;b.style.height=h;b.style.overflow='hidden';})(document.getElementsByTagName('body')[0],'1039px','768px')">iPad</a>
<a href="javascript:(function(b,w,h){b.style.width=w;b.style
@iegik
iegik / dabblet.css
Created October 26, 2012 11:50
Responsive Vertical Layout
/* Responsive Vertical Layout */
h2 { margin-top:0; margin-bottom: 1ex; font-variant: small-caps; background-color: rgba( 128, 128, 128, .5); position: relative; left: -.7ex; padding: 0 .7ex; width: 100%;}p { text-align: justify;}/* vresp */html { width: 100%; height: calc(100% - 8px);}.head, .main, .foot { min-height: 50px; background-color: rgba(129,130,128,.5); margin: 0 1ex 1ex; display:inline-block; width: calc( 100% - 2ex ); vertical-align: top;}.head, .foot { height: 25%; max-height: 120px;}.main { min-height: 300px; height: calc( 100% - 240px - 1ex ); white-space: nowrap; /* remove spaces between blocks */}.main > * { /* wrap text normaly */ white-space: normal; overflow: auto; max-height: calc( 100% - 2ex );} .wrap { max-width: 800px; min-width: 200px; width: 100%; margin: 0 auto; position: relative; height:100%;}body { height: 100%;}@media only screen and (max-height: 560px ) { /* 120 + 120 + 300 +
@iegik
iegik / compass-init.sh
Last active January 27, 2021 09:15
Compass sprite images
#!/bin/sh
if [ $1 ]; then
mkdir -p ./$1/src/sass
cd ./$1/
ln -s ~/public_html/sass/plugins ./src/sass/
compass init --css-dir static/css --images-dir static/i --javascripts-dir static/js --sass-dir src/sass -s nested --using blueprint
echo "Now You may run 'compass watch' at $1"
else
echo "usage: $project [project name]"
fi
@iegik
iegik / gitignore2svnignore.sh
Last active July 1, 2025 06:26 — forked from luisfaceira/converter.sh
Oneliner to convert svn:ignore into .gitignore
#!/bin/bash
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash
@iegik
iegik / _gradients.css.scss
Created July 30, 2012 12:32 — forked from thbar/_gradients.css.scss
SCSS mixing for CSS3 gradients
@mixin gradient($from, $to) {
/* fallback/image non-cover color */
background-color: $from;
/* Firefox 3.6+ */
background-image: -moz-linear-gradient($from, $to);
/* Safari 4+, Chrome 1+ */
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($from), to($to));
@iegik
iegik / png2gif.py
Created July 19, 2012 11:39
Converting PNG to GIF saving travsparent color
#!/usr/bin/env python
# Convert PNG images to GIF, preserving transparency
# 2008 - http://www.coderholic.com/png2gif
import sys
import Image
import random
import optparse
import os
@iegik
iegik / reset.css
Created July 18, 2012 14:54
CSS Typography reset
html, body, div, span, applet, object, iframe, table, caption,
tbody, tfoot, thead, tr, th, td, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr,
acronym, address, big, cite, code, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend {
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;
@iegik
iegik / bootstrap-editor.js
Created July 9, 2012 13:08
Bootstrap HTML5 Editor
$.fn.editable = function(options) {
var opts = $.extend({}, $.fn.editable.defaults, options);
return this.each(function() {
this.style.webkitApperiance = 'textarea';
this.contentEditable=true;
});
}
$.fn.editable.defaults = {
}
@iegik
iegik / HTMLMail.php
Created June 26, 2012 07:43
Mail object, can convert simple html with inline styles to html mail
#!/usr/bin/php
<?php
require_once('ChromePhp.php');
class HTMLMailPart{
public $content;
public $type;
public $name;
public $path;