Skip to content

Instantly share code, notes, and snippets.

View angelbotto's full-sized avatar
🏃

Angel Celis Botto angelbotto

🏃
View GitHub Profile
@angelbotto
angelbotto / init-deb.sh
Created February 5, 2015 19:35
nginx sh
#! /bin/sh
## Move the script to the init.d directory & make executable
#sudo mv init-deb.sh /etc/init.d/nginx
#sudo chmod +x /etc/init.d/nginx
## Add nginx to the system startup
#sudo /usr/sbin/update-rc.d -f nginx defaults
PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin
@angelbotto
angelbotto / nginx.conf
Created February 5, 2015 19:32
Cheers passenger recipe
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/jruby-1.7.18@cheers/gems/passenger-4.0.58;
@angelbotto
angelbotto / vineapi.md
Created October 20, 2014 21:59
vine api

Vine.app API Reference

The one and only public documentation of Vine.app 1.0.3

Common headers

user-agent: com.vine.iphone/1.0.3 (unknown, iPhone OS 6.1.0, iPhone, Scale/2.000000)
vine-session-id: <userid>-1231ed86-80a0-4f07-9389-b03199690f73
accept-language: en, sv, fr, de, ja, nl, it, es, pt, pt-PT, da, fi, nb, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8
//Invite all you friends in facebook :)
var elements = document.getElementsByClassName('uiButton');
for(var i=0;i<=elements.length;i++) { console.log(elements[i].click()); }
$.fn.textkolor = function(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour="#";
for (var j = 0; j < 3; j++) {
var value = (hash >> (j * 8)) & 0xFF; colour += ('00' + value.toString(16)).substr(-2);
$(element).textkolor("Something string");

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

@angelbotto
angelbotto / facebook
Created May 23, 2014 06:11
get facebook likes comments, share and another data from url
https://api.facebook.com/method/fql.query?query=select%20total_count,like_count,comment_count,share_count,click_count%20from%20link_stat%20where%20url=%27http://www.angelbotto.net/%27&format=json
@angelbotto
angelbotto / call_rake.rb
Created April 21, 2014 21:45
ejecute task in controllers, for more speed
def call_rake(task, options = {})
options[:padrino_env] ||= Padrino.env
args = options.map { |name,value| "#{name.to_s.upcase}='#{value}'" }
system "rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Padrino.root}/log/rake.log &"
end
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" ng-app="pc-dashboard"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>PrepagosColombia - Dashboard</title>
<base href="/">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->