Skip to content

Instantly share code, notes, and snippets.

View SleepWalker's full-sized avatar

Sviatoslav SleepWalker

View GitHub Profile
@benatkin
benatkin / Global.sublime-settings
Created July 20, 2011 04:26
excluding node_modules from Sublime Text 2
// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

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

@Sjeiti
Sjeiti / getLessVars.js
Last active September 22, 2020 04:51
function to parse LESS variables to Javascript
/**
* getLessVars parses your LESS variables to Javascript (provided you make a dummy node in LESS)
* @param {String} id The CSS-id your variables are listed under.
* @param {Boolean} [parseNumbers=true] Try to parse units as numbers.
* @return {Object} A value object containing your LESS variables.
* @example
* LESS:
* @myLessVariable: 123px;
* #dummyLessId { width: @myLessVariable; }
* Javascript:
@karlhorky
karlhorky / grayscale-disable.css
Created August 26, 2012 12:17
Cross-Browser CSS Grayscale
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(0%);
}
@jayj
jayj / flexbox.less
Last active June 23, 2024 01:14
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@rwaldron
rwaldron / emitter.js
Last active September 11, 2017 12:48
Simple Event Emitter constructor that uses a WeakMap for event storage (keywords: event emitter weakmap) ps. github's gist search is bullshit
(function( exports ) {
var priv = new WeakMap();
function Emitter() {
priv.set(this, {
events: {}
});
}
Emitter.prototype.on = function( type, handler ) {
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

<snippet>
<content><![CDATA[
<!-- begin $1 -->
<div class="$1">
$2
</div>
<!-- end $1 -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>di</tabTrigger>
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@sudodoki
sudodoki / Some_tools_icon_fonts.md
Last active August 29, 2015 14:07
Some tools for icon font

So, some tools that might help with icon fonts:

  1. Build fonts from existing glyphs:
    [IcoMoon][1] — meta-resource, using font-awesome & other fonts, either publicly available or purchasable
    [flaticon][2]

  2. Build fonts from your own images online, but needs editing special template:
    [IconVault][3]

  3. Something in between:
    [Fontastic][4]