Skip to content

Instantly share code, notes, and snippets.

View sapegin's full-sized avatar
🌄
Disconnected

Artem Sapegin sapegin

🌄
Disconnected
View GitHub Profile
@sapegin
sapegin / gist:1835465
Created February 15, 2012 12:52
Color to hex in SASS
@function _decToHex($dec) {
$h2: $dec % 16;
$h1: ($dec - $h2) / 16;
@if $h1 > 9 {
$h1: nth((a b c d e f), $h1 - 9);
}
@if $h2 > 9 {
$h2: nth((a b c d e f), $h2 - 9);
}
@sapegin
sapegin / richtypo.js
Created February 24, 2012 14:53
JS Typographer Draft
(function(global) {
////////////////////////////////////////////////////////
var symbols = {
nbsp: ' '
}
var common = {
spaces: function(text) {
@sapegin
sapegin / admin.css
Created March 26, 2012 07:24
CSS3 Popup
/**
* Window
*/
.sh-window {
opacity: 0;
position: absolute;
top: 33%;
left: 50%;
-webkit-transform: scale(.6) translate(-50%,-50%);
-moz-transform: scale(.6) translate(-50%,-50%);
@sapegin
sapegin / gist:2235116
Created March 29, 2012 08:49
Caching Ajax requests with $.Deferred
var counters = {
promises: {},
fetch: function(service, url) {
if (!counters.promises[service]) counters.promises[service] = {};
var servicePromises = counters.promises[service];
if (servicePromises[url]) {
return servicePromises[url];
}
else {
@sapegin
sapegin / gist:2320517
Created April 6, 2012 14:49
LABIR.BAS, circa 1997
ON TIMER(666) GOSUB timeroff
TIMER ON
ON KEY(7) GOSUB kadr
KEY(7) ON
ON KEY(8) GOSUB prosmotr
KEY(8) ON
ON KEY(4) GOSUB nazhatienazvonock
KEY(4) ON
ON KEY(10) GOSUB exitt
KEY(10) ON
@sapegin
sapegin / changeSelectLabels.js
Created April 27, 2012 10:52
jQuery Snippets
/**
* <option data-label-male="Dude" data-label-female="Dudette">Dude</option>
*/
$.fn.changeSelectLabels = function(key) {
key = 'label-' + key;
return $(this).each(function() {
$(this).find('option').each(function() {
var option = $(this),
label = option.data(key);
if (label)
.ಠ_ಠ {
color:red;
}
@sapegin
sapegin / whereami.php
Created May 30, 2012 15:28
Simple Foursquare last checkin proxy
<?php
/**
* Foursquare last checkin proxy
*
* Setup:
* Create file .token with your OAuth token. (You can get it here: https://elie.im/foursquare)
*
* Usage:
* //example.com/whereami.php?callback=func
*
@sapegin
sapegin / opener.py
Created June 5, 2012 10:54
Magic project opener
#!/usr/bin/env python
#
# Magic project opener
# © 2012 Artem Sapegin (sapegin.me)
#
#coding=utf-8
<a href="#">I am link!</a>