Skip to content

Instantly share code, notes, and snippets.

View kidker's full-sized avatar
🎯
Focusing

kidker kidker

🎯
Focusing
View GitHub Profile

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

@kidker
kidker / gist:5494449
Created May 1, 2013 09:20
Using .ttf fonts
Ныне это возможно вполне кроссбраузерно, правда, Интернет Эксплорер требует, чтобы шрифт был в формате EOT, в принципе, в интернете можно найти, я думаю, программы для конвертации TTF в EOT.
Пусть у меня есть некий шрифт, cool_font.ttf для обычного начертания и cool_font_b.ttf для жирного. Переведём эти шрифты в формат EOT, назовём их cool_font.eot и cool_font_b.eot и положим все 4 файла в корень сайта. Тогда CSS-таблица будет выглядеть примерно так:
@font-face {
font-family: 'cool_font_eot';
font-weight: normal;
src: url('/cool_font.eot');
}
@font-face {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS responsive images</title>
<style>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {
/**
* Напишите функцию, которая из произвольного входящего массива выберет все комбинации чисел, сумма которых будет равняться 10
*
* @see http://company.yandex.ru/job/vacancies/dev_int_yaservices.xml
* @param {Array} ITEMS
* @param {Integer} target
* @example findCombinations([ 7, 10, 2, 5, 3, 1 ], 10) => [[7, 2, 1], [7, 3], [10], [2, 5, 3]]
* @returns {Array}
*/
function findCombinations (ITEMS, target)

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

Angularjs (versions below 1.1.5) does not provide the if/else functionality . Following are a few options to consider for what you want to achieve:
(Jump to the update below (#4) if you are using version 1.1.5 or greater)
1. ng-switch directive:
can be used something like the following.
<div ng-switch on="video">
<div ng-switch-when="video.large">
<xsl:for-each select="*">
<xsl:value-of select="."/> |
<xsl:value-of select="name()"/>
<br></br>
</xsl:for-each>
function guid() {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
// Create the XHR object.
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// XHR for Chrome/Firefox/Opera/Safari.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
// XDomainRequest for IE.
xhr = new XDomainRequest();
xhr.open(method, url);
// INTRO console.log message
console.log(
'%cWelcome to %cZing%cChart%c'
,'color:#505050; font:normal 1.4em/1.4em arial'
,'color:#003849; font:normal 1.5em/1.4em arial'
,'color:#00bbf1; font:normal 1.5em/1.4em arial'
,'color:#505050; font:normal 1.4em/1.4em arial'
);