Skip to content

Instantly share code, notes, and snippets.

View yetithefoot's full-sized avatar
:octocat:
Loading status...

Vlad Tsepelev yetithefoot

:octocat:
Loading status...
View GitHub Profile
@yetithefoot
yetithefoot / gist:74974c3840c195ade897
Created December 10, 2015 06:36 — 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
@yetithefoot
yetithefoot / average-github-title.sh
Created November 25, 2016 07:53
Shows average issue title length for repo
#!/bin/bash
curl "https://api.github.com/repos/d3/d3/issues?per_page=1000" | jq '.[] | .title' | awk '{ print length($0); }' | jq -s 'add/length'
@yetithefoot
yetithefoot / add.js
Last active September 19, 2016 15:01
Junior Front-end Developer | Add function
function add(){
// write your one-line implementation here
}
// should prints 7
console.log(add(2,5));
// should prints 7
console.log(add(2)(5));
@yetithefoot
yetithefoot / duplicate.js
Last active September 19, 2016 14:11
Junior Front-end Developer | Duplicate function
function duplicate(){
// write your one-line implementation here
}
// should prints [1,2,3,4,5,1,2,3,4,5]
console.log(duplicate([1,2,3,4,5]));
// should prints ['a','b','c','a','b','c']
console.log(duplicate(['a','b','c']));
@yetithefoot
yetithefoot / UIImage+AverageColor
Created September 24, 2012 15:02
UIImage average color
@implementation UIImage (AverageColor)
- (UIColor *)averageColor {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
unsigned char rgba[4];
CGContextRef context = CGBitmapContextCreate(rgba, 1, 1, 8, 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGContextDrawImage(context, CGRectMake(0, 0, 1, 1), self.CGImage);
CGColorSpaceRelease(colorSpace);
@yetithefoot
yetithefoot / parsecom2csv
Created December 26, 2013 14:31
Retrieves Parse.com object, filter it and converts to CSV(without header)
# converts Parse.com json object presentation to CSV with simple filtering
# dependency - jq command line tool
# NOTE: Parse.com API does not allow to get more than 1000 records per request, so you need to vary skip and limit params
# https://www.parse.com/docs/rest#general-quick
# NOTE: Also you can download exported Parse.com backup (Parse.com\Settings\Export) and read via "cat filename | jq '.'".
echo `curl -H 'X-Parse-Application-Id: <PASTE_YOUR_APP_ID_HERE>' -H 'X-Parse-REST-API-Key: <PASTE_YOUR_REST_API_KEY_HERE>' -H 'Content-Type: application/json' -L https://api.parse.com/1/classes/Email\?skip=0\&limit=1000 -s` | jq '.results[] | .email +","+.type +","+ .createdAt'
@yetithefoot
yetithefoot / blinking.css
Created November 15, 2013 16:54
Css blinking style. Just add this class to element you want to blink.
.blinking {
animation-name: blinker;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
-webkit-animation-name: blinker;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
apt-get update
apt-get install -y build-essential libssl-dev zlib1g-dev wget
apt-get remove -y libruby1.8 ruby1.8 ruby1.8-dev rubygems
rm -f /usr/bin/gem
apt-get install -y ruby1.9.1 ruby1.9.1-dev libruby1.9.1
gem update --no-rdoc --no-ri -y
gem install ohai --no-rdoc --no-ri --verbose
gem install chef --no-rdoc --no-ri --verbose
gem install knife-solo --no-rdoc --no-ri --verbose
/*
Copyright 2012 Adobe Systems, Incorporated
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License http://creativecommons.org/licenses/by-nc-sa/3.0/ .
Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe http://www.adobe.com/communities/guidelines/ccplus/commercialcode_plus_permission.html .
*/
precision mediump float;
// This uniform value is passed in using CSS.
uniform float value;