Skip to content

Instantly share code, notes, and snippets.

View fethica's full-sized avatar
:octocat:

Fethi El Hassasna fethica

:octocat:
View GitHub Profile
@fethica
fethica / my_bootstrsp.js
Created November 23, 2013 02:29
Bootstrap: Responsive navbar collapse for single page applications
$('.navbar a.navbar-link').click(function() {
var navbar_toggle = $('.navbar-toggle');
if (navbar_toggle.is(':visible')) {
navbar_toggle.trigger('click');
}
});
@fethica
fethica / detect_language.php
Created December 13, 2013 20:24
Detect Browser Language in PHP
<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
case "fr":
//echo "PAGE FR";
include("index_fr.php");//include check session FR
break;
case "it":
//echo "PAGE IT";
include("index_it.php");
@fethica
fethica / check_SDK.java
Created December 28, 2013 23:04
Retrieving Android API version programmatically.
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO){
// Do something for froyo and above versions
} else{
// do something for phones running an SDK before froyo
}
public class Json {
public static JSONObject getJson(String url){
InputStream is = null;
String result = "";
JSONObject jsonObject = null;
// HTTP
try {
-- create table
CREATE TABLE cities
(
id INT PRIMARY KEY NOT NULL auto_increment,
cityName VARCHAR(255),
cityState VARCHAR(255),
cityPopulation int,
country VARCHAR(255)
);
<?php
/***************************************************************
Description: City data in JSON.
Developer: Vishal Kurup
***************************************************************/
$host = "abc12345"; //Your database host server
$db = "abc12345"; //Your database name
$user = "abc12345"; //Your database user
<?php
$data = (object)array(
"html" => "<foo bar=\"baz\"/> &amp;",
"arabic" => "العربية al-ʿarabiyyah, IPA: [æl ʕɑrɑˈbijjɐ], or عربي ʿarabī",
"hebrew" => "עִבְרִית, Ivrit",
"chinese" => "汉语/漢語 Hanyu; 华语/華語 Huáyǔ; 中文 Zhōngwén",
"korean" => "한국어/조선말",
"japanese" => "日本語 Nihongo",
"umlauts" => "äüöãáàß",
@fethica
fethica / chrome
Created September 28, 2014 11:00
Start Google Chrome on Mac with file access
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files
@fethica
fethica / color.m
Last active August 29, 2015 14:15 — forked from kylefox/color.m
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>