Skip to content

Instantly share code, notes, and snippets.

@mosheeshel
mosheeshel / ResourceFileResolver.java
Created January 1, 2014 05:28
Locates a file inside your resources whether they are in a "normal" resource directory or inside a jar - untested, for reference only
package com.acme.example;
import com.sun.javaws.Launcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
@mosheeshel
mosheeshel / gist:6078123
Created July 25, 2013 09:17
Android Code for start emulator parameters to "force" hebrew And code to force App to load the hebrew resources (based on language string
// parameters for emulator
-prop persist.sys.language=iw -prop persist.sys.country=IL
// Force Locale Change
String languageToLoad = "iw";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
@mosheeshel
mosheeshel / gist:6051907
Created July 22, 2013 07:23
Youtube parsing functions, this are brute force methods to get youtube video ID from URL.
function get_youtube_id( $youtube_url ) {
$url = parse_url($youtube_url);
if( $url['host'] !== 'youtube.com' &&
$url['host'] !== 'www.youtube.com'&&
$url['host'] !== 'youtu.be'&&
$url['host'] !== 'www.youtu.be')
return '';
@mosheeshel
mosheeshel / gist:6020354
Created July 17, 2013 13:00
parseUri 1.2: Split URLs in JavaScript from: http://blog.stevenlevithan.com/archives/parseuri Highlights: Comprehensively splits URIs, including splitting the query string into key/value pairs. (Enhanced) Two parsing modes: loose and strict. (New) Easy to use (returns an object, so you can do, e.g., parseUri(uri).anchor). Offers convenient, pre-…
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
@mosheeshel
mosheeshel / uri.js
Created July 17, 2013 12:59 — forked from jlong/uri.js
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"
@mosheeshel
mosheeshel / gist:6007484
Last active December 19, 2015 19:38 — forked from MichelleGlauser/gist:5323089
getsatisfaction customization code how to add a button to subscribe to a feed (not real product feed)
<!-- Subscribe to all topics. -->
<!-- Steps to a subscribe-to-all-topics button:
1. make a product for all topics, get ID number (87939: http://michelleglauser.jarg0n.com/gsfnmichelle/products/gsfnmichelle_all_topics)
2. make all new topics automatically be assigned to that product by ID number (through a jQuery click on that element)
3. hide that product by ID number
4. make a subscribe button on the front page
5. give the subscribe button a call to the product page's follow button -->
<!-- Header HTML: -->