Skip to content

Instantly share code, notes, and snippets.

View agat's full-sized avatar

Aleksej Romanovskij agat

View GitHub Profile
@cowboy
cowboy / HEY-YOU.md
Last active July 1, 2024 08:37
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@joshuapowell
joshuapowell / reset.less
Last active December 12, 2021 13:35
LESS: Global LESS CSS reset that gives elements default formatting.
/**
* Global Reset of all HTML Elements
*
* Resetting all of our HTML Elements ensures a smoother
* visual transition between browsers. If you don't believe me,
* try temporarily commenting out this block of code, then go
* and look at Mozilla versus Safari, both good browsers with
* a good implementation of CSS. The thing is, all browser CSS
* defaults are different and at the end of the day if visual
* consistency is what we're shooting for, then we need to
@agat
agat / jquery.micro-tabs.min.js
Created April 20, 2012 07:03
Smallest jQuery tabs plugin
/* micro tabs jQuery plugin by Aleksej Romanovskij */
$.fn.tabs=function(c){this.click(function(){var a=$(this);a.parent().add($(a.attr('href'))).addClass(c).siblings().removeClass(c);return!1})}
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@agat
agat / gist:3104610
Created July 13, 2012 12:19
Sencha Touch CSS example
.x-button.x-button-action.x-button-pressing,
.x-button.x-button-action.x-button-pressing:after,
.x-button.x-button-action.x-button-pressed,
.x-button.x-button-action.x-button-pressed:after,
.x-button.x-button-action.x-button-active,
.x-button.x-button-action.x-button-active:after,
.x-toolbar .x-button.x-button-action.x-button-pressing,
.x-toolbar .x-button.x-button-action.x-button-pressing:after,
.x-toolbar .x-button.x-button-action.x-button-pressed,
.x-toolbar .x-button.x-button-action.x-button-pressed:after,
@silentworks
silentworks / gist:3608022
Created September 3, 2012 09:07
MODX Resource List with Type Ahead

Create a new Template Variable

Go to Input Options Tab

Change Input Type to:

  • Listbox (Multi-Select) - for multiple resource select
  • Listbox (Single-Select) - for Single resource select

In Input Option Values type: @SELECT `pagetitle` AS `name`,`id` FROM `[[+PREFIX]]site_content` WHERE `published` = 1 AND `deleted` = 0

@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

/* normal flexbox */
.flexbox .flex-container {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
}
.flexbox .flex-container.vertical {
display: -webkit-flex;
display: -moz-flex;
@windyjonas
windyjonas / wordpress-escaping.md
Last active September 21, 2020 16:10
Most of the escaping functions in WordPress, with a short explanation and example.

WordPress escaping functions

By: Jonas Nordström, @windyjonas
Date: 2013-04-16

esc_attr( $text );
Encodes the <, >, &, " and ' (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Example: