Skip to content

Instantly share code, notes, and snippets.

@mpost
mpost / cordova_config.xml
Created July 2, 2015 13:26
The gist demonstrates how to create a custom Tabris.js Android theme.
<?xml version='1.0' encoding='utf-8'?>
<widget
xmlns="http://www.w3.org/ns/widgets"
id="com.eclipsesource.sandbox.theme"
version="1.0.0">
<name>Tabris.js Android Theming Sandbox</name>
<hook type="after_platform_add" src="scripts/android/afterPlatformAdd.js" />
@refo
refo / remove-leading-slash
Created June 5, 2015 13:27
javascript - Remove leading slashes
'/example/string/'.replace(/^\/+/g, '');
// Should remove all leading slashes and return 'example/string/'
@tbranyen
tbranyen / _usage.md
Last active April 19, 2024 12:24
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@thebucknerlife
thebucknerlife / deploying_rails_to_heroku.md
Created October 20, 2014 23:41
A Beginners Guide to Deploying a Rails App on Heroku

Deploying to Heroku

This guide is for a first-time Rails developer to deploy their app to Heroku, a popular web-hosting service with strong Rails support. This guide assumes you already have a Heroku account and have installed the Heroku Toolbelt.

Create Your App and Setup Heroku with Git

  1. Make sure you've setup an SSH key for Heroku. Follow this simple guide to create an SSH key and send it to Heroku if needed: Heroku: Managing Your SSH Keys
  2. Navigate into the folder for your Rails app.
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@ngsmrk
ngsmrk / sidekiq_monitoring
Created August 11, 2014 11:51
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
@seyhunak
seyhunak / vin_to_gif.rb
Created July 20, 2014 09:03
Vine MP4 to GIF Converting using Ruby
# space150 vine-to-GIF
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it
# requires ruby, ffmpeg, and imagemagick
require 'open-uri'
require 'nokogiri'
id = ARGV[0]
# try to convert from URL to id.
@nitaku
nitaku / README.md
Last active May 12, 2024 22:24
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@otobrglez
otobrglez / jaccard_recommendation.rb
Last active April 2, 2024 17:51
Simple recommendation system written in Ruby based on Jaccard index.
# Simple Recommendation Engine in Ruby
# Visit: http://otobrglez.opalab.com
# Author: Oto Brglez <otobrglez@gmail.com>
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
@benplum
benplum / HTML5 Enabler
Created December 19, 2013 20:06
HTML5 Enabler
/* Pre-Define HTML5 Elements in IE */
(function(){ var els = "source|address|article|aside|audio|canvas|command|datalist|details|dialog|figure|figcaption|footer|header|hgroup|keygen|mark|meter|menu|nav|picture|progress|ruby|section|time|video".split('|'); for(var i = 0; i < els.length; i++) { document.createElement(els[i]); } } )();