Skip to content

Instantly share code, notes, and snippets.

View tranquangchau's full-sized avatar

Trần Quang Châu tranquangchau

View GitHub Profile
@tranquangchau
tranquangchau / wordpress wp_postmeta export mysql sql.php
Last active December 28, 2019 04:45
wordpress wp, export datbase post wp_postmeta
<?php
$servername = "localhost";
$username = "site_wp_bk_1812";
$password = "";
$dbname = "site_wp_bk_1812";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
@tranquangchau
tranquangchau / check_pass_first.php
Created December 17, 2019 08:16
script php basic check password first before run everything
<?php
session_start();
$errorMsg = "";
$validUser = false;
if(isset($_SESSION['firstlogin'])) {
$validUser = $_SESSION["firstlogin"] === true;
}
//$pass_has = password_hash("123456", PASSWORD_DEFAULT);
//echo $pass_has; //get password first
@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
@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;
@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";
@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>
<?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) {
@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.
@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 >
@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
*