Skip to content

Instantly share code, notes, and snippets.

View speed-of-light's full-sized avatar

Speed of Light speed-of-light

View GitHub Profile
@speed-of-light
speed-of-light / svg_png.js
Last active May 23, 2018 16:08
Get that svg as png
var png = {
selector: "#aaaa",
w: "500px", h: "500px",
fn: "fallback.png"
};
function svg2png({ selector, w, h, fn }) {
var svg = document.querySelector( selector );
var svgData = new XMLSerializer().serializeToString( svg );
@speed-of-light
speed-of-light / job_control_zsh_bash.md
Created March 7, 2017 14:41 — forked from CMCDragonkai/job_control_zsh_bash.md
CLI: Job Control in ZSH and Bash

Job Control in ZSH and Bash

All processes in ZSH/Bash under job control are in 3 states: foregrounded, backgrounded and suspended.

# run command in the foreground
command
# run commend in the background
@speed-of-light
speed-of-light / active.md
Created April 20, 2016 09:00 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Mon, 01 Dec 2014 00:48:25 GMT till Tue, 01 Dec 2015 00:48:25 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 508)
// usage:
// @breakpoint(xxs)
// font-size: 10px
@mixin breakpoint($point)
@if $point == xxs
@media (max-width: 130px)
@content
@else if $point == xs
@media (min-width: 240px)
@speed-of-light
speed-of-light / gist:27875daf0eb46f629d84
Created March 10, 2016 15:54 — forked from phgrau/gist:4048239
a quick and dirty tips-n-tricks for ansible

Variables

predefined variables :

  • inventory_hostname (fqdn) (normally the same as ansible.fqdn)
  • inventory_hostname_short

To know the return codes returned by ansible modules, just use plain ansible -vvv to see them : ansible -i ~/ansible/arrfab.net/hosts/hosts.cfg -vvv -m copy -a 'src=files/sysinfo dest=/etc/sysinfo' tungstene.arrfab.net tungstene.arrfab.net | success >> { "changed": true,

@speed-of-light
speed-of-light / LighttpdReverseProxyURLRewriting
Created March 4, 2016 09:28 — forked from ebouchut/LighttpdReverseProxyURLRewriting
Lighttpd reverse-proxy to that matches an URL _and_ does URL rewriting
#server.modules += ( "mod_rewrite")
# Workaround to have a working reverse-proxy that matches an URL does URL rewriting in Ligghtpd.
#
# Ligtthpd 1.4.28 cannot perform both matching and URL rewriting at the same time.
# Therefore we need to define 2 proxies, one does the matching and bounce the request
# to the other one, in charge of rewriting the URL before proxying the request to the target server.
#
# More about this here:
# http://redmine.lighttpd.net/issues/164#note-9
@speed-of-light
speed-of-light / bobp-python.md
Created January 25, 2016 09:32 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@speed-of-light
speed-of-light / gist:a874bedd2d817cef5faa
Created October 9, 2015 14:24 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter