Skip to content

Instantly share code, notes, and snippets.

View hgouveia's full-sized avatar

Jose De Gouveia hgouveia

View GitHub Profile
@shiawuen
shiawuen / index.html
Created December 29, 2011 15:05
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>
@JonathanNye
JonathanNye / gist:2229968
Created March 28, 2012 19:55
Simple bottom "stroke" XML drawable for Android View backgrounds
<!-- This produces a 1.5dp stroke along the bottom of a View. It works by drawing the stroke color as the background of the View, then the background color on top, offset up by 1.5dp. Unfortunately, this approach
only works if you have solid color backgrounds. For transparency, you'll have to use a 9patch. -->
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="rectangle">
<solid android:color="STROKE_COLOR_HERE"/>
@keeguon
keeguon / countries.json
Created April 5, 2012 11:11
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@mburst
mburst / jquery_autocomplete.html
Created January 19, 2013 20:51
jQuery Autocomplete
<!DOCTYPE html>
<html>
<head>
<title>jQuery Autocomplete</title>
<style>
#res {
margin: 0px;
padding-left: 0px;
width: 150px;
}
@jirutka
jirutka / analytics.conf
Created March 31, 2013 01:03
Add Google Analytics tracking code to HTML via nginx
#
# Add Google Analytics tracking code to HTML response
#
# Usage:
# set $tracking_id 'UA-12345678-9';
# include incl/analytics.conf;
#
# It needs nginx compiled with option --with-http_sub_module.
# Uses optimized GA code from: http://mathiasbynens.be/notes/async-analytics-snippet
#
@MobiDevelop
MobiDevelop / ArchiveFileHandle.java
Created May 3, 2013 21:28
A ZipFile-based FileHandle implementation for LibGDX.
package com.mobidevelop.gdx.examples;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.files.FileHandle;
@kmark
kmark / plexDownload.php
Last active May 17, 2024 02:08
The Plex Universal Transcoder Downloader mimics the actions of the Plex/Web media flash player to download transcoded media. The differences begin when the downloader saves the streamed data and pieces it together. First a start.m3u8 playlist file is requested from the server with a query string that defines the transcoding options. Inside the …
<?php
/*******************************************************************************
* Plex Universal Transcoder Downloader v1.3 *
* See --help or --usage for more info *
*******************************************************************************
* Copyright 2013 Kevin Mark *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
@ivamluz
ivamluz / twitter4j-find-replies.java
Last active June 6, 2023 16:22
Code snippet showing how to post a reply to a tweet using twitter4j library
public static List<Status> findReplies() {
Query query = new Query("iluzcit");
List<Status> tweets = new ArrayList<Status>();
Twitter twitter = new TwitterFactory().getInstance();
try {
QueryResult result;
do {
result = twitter.search(query);