Skip to content

Instantly share code, notes, and snippets.

Marian Kostadinov kapitancho

View GitHub Profile
@kapitancho
kapitancho / es6.js
Created Dec 24, 2015
RequireJS plugin for es6 + babel 6.
View es6.js
define(['module'], function (module) {
'use strict';
var fetchText = function(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function(evt) {
if (xhr.readyState === 4) {
callback(xhr.responseText);
}
@kapitancho
kapitancho / nodeclick.html
Created Oct 17, 2015
Nodeclick mini function
View nodeclick.html
<!DOCTYPE html>
<html>
<head>
<script>
//Add a single event listener that handles one or more actions based on the data-* attributes.
var nodeclick = function (container, mapping, omitHref) {
container.addEventListener ('click', function(event) {
var el = event.target;
while (el != container) {
if (el.href && omitHref !== false) return;
@kapitancho
kapitancho / demo.html
Created Mar 21, 2013
Rotate an image in a canvas
View demo.html
<!DOCTYPE html>
<html lang="en">
<head>
<style>
* {
margin: 0;
padding: 0;
}
canvas {
outline: solid 1px black;
@kapitancho
kapitancho / gist:5099504
Created Mar 6, 2013
IE 6 and IE 7 solution for generated content. This example shows how to emulate generated content in IE6 and IE7. It shows how to use content:attr (attribute name) and content : 'some text' and how to style the generated elements. Known issues: As the example below shows, a skew transition is applied to an element and to a :before element. Unfor…
View gist:5099504
<!DOCTYPE html>
<html>
<head>
<style>
.test {
background: red;
zoom: expression(
this.runtimeStyle.zoom="1",
this.insertBefore( document.createElement("before"), this.firstChild ).innerHTML = this.getAttribute ('data-for-before'),
this.appendChild( document.createElement("after") ).innerHTML = ' after-content '
@kapitancho
kapitancho / inline-block.html
Created Jul 19, 2012
Cross-browser use of inline-block with spacing issues resolved for any font-family and font-size
View inline-block.html
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
font-size: 15px;
font-family: Arial;
overflow: hidden;
You can’t perform that action at this time.