Skip to content

Instantly share code, notes, and snippets.

@jcarhuazv
jcarhuazv / webflow.js
Created September 11, 2021 19:36 — forked from kvyb/webflow.js
/*!
* Webflow: Front-end site library
* @license MIT
* Inline scripts may access the api using an async handler:
* var Webflow = Webflow || [];
* Webflow.push(readyFunction);
*/
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@jcarhuazv
jcarhuazv / test.js
Created May 26, 2018 22:20 — forked from jmyrland/test.js
Socket-io load test?
/**
* Modify the parts you need to get it working.
*/
var should = require('should');
var request = require('../node_modules/request');
var io = require('socket.io-client');
var serverUrl = 'http://localhost';
@jcarhuazv
jcarhuazv / GPano.xmp.xml
Created March 19, 2018 18:03 — forked from 02015678/GPano.xmp.xml
GPano Photo Sphere XMP Tag Sample
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 10.16'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about="" xmlns:GPano="http://ns.google.com/photos/1.0/panorama/">
<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
<GPano:CaptureSoftware>Photo Sphere</GPano:CaptureSoftware>
<GPano:StitchingSoftware>Photo Sphere</GPano:StitchingSoftware>
<GPano:ProjectionType>equirectangular</GPano:ProjectionType>
<GPano:PoseHeadingDegrees>0.0</GPano:PoseHeadingDegrees>
@jcarhuazv
jcarhuazv / Cricket data.py
Created December 5, 2017 00:49 — forked from hybridjosto/Cricket data.py
scraping data from a web table using python and Beautiful Soup
import urllib2
from bs4 import BeautifulSoup
# http://segfault.in/2010/07/parsing-html-table-in-python-with-beautifulsoup/
f = open('cricket-data.txt','w')
linksFile = open("linksSource.txt")
lines = list(linksFile.readlines())
for i in lines[12:108]: #12:108
url = "http://www.gunnercricket.com/"+str(i)
try:
@jcarhuazv
jcarhuazv / countries.sql
Created September 11, 2016 00:55 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@jcarhuazv
jcarhuazv / gist:c332e295306020d08800
Last active August 29, 2015 14:27 — forked from jonathanmoore/gist:2640302
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

# Filename: RAILS_ROOT/lib/paperclip_processors/thumbnail_with_dimensions.rb
# Required Configuration in the model
# has_attached_file :image,
# :styles => {
# :thumbnail => {
# :geometry => "100x100>",
# :format => :png,
# :processors => [:thumbnail_with_dimensions],
# :mystyle => :thumbnail
# },
# Adds behavior for getting, setting, and validating
# images for any given model. Relies on RAILS_ROOT/config/image_definitions.rb
module ImageHandling
def self.included(base)
base.class_eval do
# Defines accessor names: if the class is Book,
# names will be #book_images and #book_images=
image_accessor_name = self.to_s.underscore + "_images"
source 'https://rubygems.org'
gem 'sinatra', '1.4.6'