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

<!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

@kidker
kidker / ngEnter.js
Created February 25, 2016 16:57 — forked from EpokK/ngEnter.js
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@kidker
kidker / all-templates.html
Created May 26, 2016 15:42 — forked from vojtajina/all-templates.html
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@kidker
kidker / uri.js
Created June 25, 2016 16:57 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
@kidker
kidker / LoadSite.php
Created June 24, 2017 02:27 — forked from davidrushton/LoadSite.php
Laravel multi-tenant multi-database
<?php
//app/Http/Middleware/LoadSite.php
namespace App\Http\Middleware;
use App\Exceptions\SiteNotFoundException;
use App\Sites\SiteRepository;
use App\Sites\SiteService;
use Closure;
@kidker
kidker / foldersize.php
Created September 27, 2017 19:02 — forked from eusonlito/foldersize.php
PHP function to get the folder size including subfolders
<?php
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}