Skip to content

Instantly share code, notes, and snippets.

View emmgfx's full-sized avatar
🏠
Working from home

Josep Viciana emmgfx

🏠
Working from home
View GitHub Profile
@emmgfx
emmgfx / gist:4554728
Last active December 11, 2015 05:48
SQL con where dinámico
<?PHP
$sql = "SELECT foo FROM bar WHERE 1 = 1";
if ($filter1){
$str.=" and col1='frobozz'";
}
?>
@emmgfx
emmgfx / gist:4721071
Created February 6, 2013 07:59
text overflow ellipsis
p.test {
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
@emmgfx
emmgfx / gist:5194361
Created March 19, 2013 07:44
php.ini recursivo en htaccess
SuPHP_ConfigPath /home/username/public_html/php.ini
nombre name nom iso2 iso3 phone_code
Afganistán Afghanistan Afghanistan AF AFG 93
Albania Albania Albanie AL ALB 355
Alemania Germany Allemagne DE DEU 49
Algeria Algeria Algérie DZ DZA 213
Andorra Andorra Andorra AD AND 376
Angola Angola Angola AO AGO 244
Anguila Anguilla Anguilla AI AIA 1 264
Antártida Antarctica L'Antarctique AQ ATA 672
Antigua y Barbuda Antigua and Barbuda Antigua et Barbuda AG ATG 1 268
@emmgfx
emmgfx / layout.xml
Created November 24, 2013 17:22
Add image to textview. See the drawableRight parameter.
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@android:drawable/presence_busy"
android:text="@string/signup"
android:textAppearance="?android:attr/textAppearanceMedium" />
@emmgfx
emmgfx / gist:0f018b5acfa3fd72b3f6
Created May 2, 2014 07:49
Android JSONArray remove before API 19
// Example of use: remove(i, savedProfiles);
public static JSONArray remove(final int idx, final JSONArray from) {
final List<JSONObject> objs = asList(from);
objs.remove(idx);
final JSONArray ja = new JSONArray();
for (final JSONObject obj : objs) {
ja.put(obj);
}
@emmgfx
emmgfx / .editorconfig
Last active June 15, 2017 15:53
Boilerplate
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
@emmgfx
emmgfx / gist:75c8fa87636ec0e35995
Created February 5, 2015 08:18
Debug Symfony2
<?PHP
namespace ...
...
use Symfony\Component\Debug\Debug;
Debug::enable();
class ... extends Controller
$age = date_diff(date_create($bdate), date_create('now'))->y;
@emmgfx
emmgfx / gist:5fb1ab747e9f643e5dfd
Last active August 29, 2015 14:22
Javascript number pad
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
// Examples:
var i = 1;