Skip to content

Instantly share code, notes, and snippets.

View tranquangchau's full-sized avatar

Trần Quang Châu tranquangchau

View GitHub Profile
@bohman
bohman / viewport.js
Last active November 20, 2020 11:37
jQuery get viewport size
// -----------
// Debugger that shows view port size. Helps when making responsive designs.
// -----------
function showViewPortSize(display) {
if(display) {
var height = jQuery(window).height();
var width = jQuery(window).width();
jQuery('body').prepend('<div id="viewportsize" style="z-index:9999;position:fixed;top:40px;left:5px;color:#fff;background:#000;padding:10px">Height: '+height+'<br>Width: '+width+'</div>');
jQuery(window).resize(function() {
@sourcerebels
sourcerebels / symfony2-create-bundle.sh
Created February 11, 2012 18:00
PHP > Symfony2 > Clear routes and twig templates cache
# Execute this from your Symfony2 path
php app/console cache:clear --env=prod --no-debug
@joshuapekera
joshuapekera / bootstrap-scrollspy-horizontal.js
Created April 20, 2012 23:17 — forked from marcoleong/bootstrap-scrollspy-horizontal.js
Modified bootstrap-scrollspy.js to support horizontal scroll.
/* =============================================================
* bootstrap-scrollspy.js v2.0.1
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* 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
*
@nathanpc
nathanpc / phonegap_download_example.html
Created April 22, 2012 13:11
Sample code to download file from internet - Phonegap Wiki
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >
@sgmurphy
sgmurphy / url_slug.php
Created July 12, 2012 15:52
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.
<?php
function parseFavicon($html) {
// Get the 'href' attribute value in a <link rel="icon" ... />
// Also works for IE style: <link rel="shortcut icon" href="http://www.example.com/myicon.ico" />
// And for iOS style: <link rel="apple-touch-icon" href="somepath/image.ico">
$matches = array();
// Search for <link rel="icon" type="image/png" href="http://example.com/icon.png" />
preg_match('/<link.*?rel=("|\').*icon("|\').*?href=("|\')(.*?)("|\')/i', $html, $matches);
if (count($matches) > 4) {
@cosmicscr
cosmicscr / bootstrap_3_full_class_list
Last active June 3, 2023 00:07
bootstrap 3 full class list
Here are all the classes from Bootstrap 3 (version 3.1.1).
Method of extraction:
1. Download Bootstrap 3 and rename bootstrap.css as "bootstrap.html"
2. Add the following 24 lines of code to the very bottom of the bootstrap.html file:
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script>
@onigetoc
onigetoc / get_favicon_v2.php
Last active February 23, 2018 15:36
Get Favicon V2
<?php
echo "<h2>Get Favicons URLs</h2>";
//$url = "https://mrmondialisation.org";
//$url = "http://stackoverflow.com/";
//$url = "http://changera.blogspot.ca/";
//$url = "http://veteranstoday.com";
$url = "http://www.2012un-nouveau-paradigme.com/";
//$url = "http://www.stopmensonges.com/";
//$url = "http://reseauinternational.net";
@tranquangchau
tranquangchau / listview scroll end.java
Last active November 8, 2016 17:26
listview check when scroll end
//http://stackoverflow.com/a/32904001
package com.javahelps.externaldatabasedemo;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
@selwynpolit
selwynpolit / read_csv.php
Last active February 14, 2024 16:56
Php code to read a csv file of any size without exhausting memory and let you process it in chunks
/*
Reads a CSV file in chunks of 10 lines at a time
and returns them in an array of objects for processing.
Assumes the first line of the CSV file has headings
that will be used as the object name for the item you are
processing. i.e. the heading is CurrentURL then refer to
$item->CurrentURL