Skip to content

Instantly share code, notes, and snippets.

@aheinze
aheinze / gist:a3a702d652523021165b
Created May 28, 2015 09:19
replace color usage in style rules
(function() {
var styles, style, rules, rule, error,
props = ['backgroundColor', 'color'], primaryColor = 'red', replaceColor: 'blue';
document.body.style.visibility = 'hidden';
try {
styles = document.styleSheets;
@aheinze
aheinze / gist:02db57da725cf7ba4047
Last active October 30, 2022 07:30
letterAvatar - create Letter avatar based on name initials
/*
* LetterAvatar
*
* Create Letter avatar based on Initials -
* based on https://gist.github.com/leecrossley/6027780
*/
(function(w, d){
function LetterAvatar (name, size) {
@aheinze
aheinze / execute.js
Last active February 25, 2016 16:05
Execute async function
/**
asyncexec(function(times){
for (var x=0, y;x<times;x++) {
y = x/2;
}
release(x);
@aheinze
aheinze / gist:263225e99ca18e2dc2f636d49e7f6357
Last active July 13, 2016 07:45
Get css variable (cross browser)
/**
<style>
.var-test:before {
content: 'hello';
}
</style>
@aheinze
aheinze / fuzzy-search.php
Last active August 20, 2018 07:44
Fuzzy Search function - returning score
<?php
function fuzzy_search($search, $text, $distance = 3){
$needles = explode(' ', mb_strtolower($search, 'UTF-8'));
$tokens = explode(' ', mb_strtolower($text, 'UTF-8'));
$score = 0;
$levenshtein_utf8 = function ($s1, $s2) {
$map = [];
http://compose.mail.yahoo.com/?to={email_address}&subject={title}&body={url}
http://digg.com/submit?url={url}
http://pinterest.com/pin/create/link/?url={url}
http://service.weibo.com/share/share.php?url={url}&appkey=&title={title}&pic=&ralateUid=
http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}
http://surfingbird.ru/share?url={url}&description={text}&screenshot={image}&title={title}
http://vk.com/share.php?url={url}&title={title}&comment={text}
http://widget.renren.com/dialog/share?resourceUrl={url}&srcUrl={url}&title={title}&description={text}
http://www.addthis.com/bookmark.php?url={url}
http://www.douban.com/recommend/?url={url}&title={title}