Skip to content

Instantly share code, notes, and snippets.

View muthu32's full-sized avatar

Muthu Kumar muthu32

  • Selvam Softech
  • TamilNadu
View GitHub Profile
@muthu32
muthu32 / jqm-indexedDB-example.html
Created January 3, 2018 09:23 — forked from greenido/jqm-indexedDB-example.html
indexedDB with jquerymobile - example 1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Short example on using indexedDB with jquery mobile - last updated: May 2012">
<meta name="author" content="Ido Green">
<title>IndexedDB with JQM</title>
<?php
* This demo is partly based on a post by Anthony Sterling on the sitepoint forum.
* It is partly based on a video by John Lebensold of killerphp.com
*
* http://www.sitepoint.com/forums/showthread.php?t=636303
*
* AnthonySterling
* Twitter: @AnthonySterling
*
* Here's a rather ridiculous, yet interesting way to use __call.
//Select class selector
//select option by index
$('#frakt_type option:eq(0)').prop("selected",true);
//select option by value
$('#frakt_type option[value="'+4+'"]').prop("selected",true);
//Select option by contains
$('#frakt_type option:contains("find_text")').prop("selected",true);
Google Suggestion
//Old format
http://suggestqueries.google.com/complete/search?hl=sv&output=toolbar&q=vxthus
//new format
http://clients1.google.com/complete/search?hl=sv&output=toolbar&q=vxthus
//Suspicious
https://www.google.se/complete/search?client=psy-ab&hl=en-IN&tok=0&q=droppslanga
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
@muthu32
muthu32 / Cache.php
Created February 23, 2018 05:55
Cache headers for images
header('Content-Type: image/png');
$modified = $ch->lastmodified();
if($modified)
{
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $modified)
{
header('HTTP/1.0 304 Not Modified'); exit();
}
//echo $modified;
header('Last-Modified: ' .gmdate('D, d M Y H:i:s T', $modified).' GMT');
@muthu32
muthu32 / levenshtein.sql
Created February 27, 2018 04:18 — forked from endihunter/levenshtein.sql
MySQL Levenshtein distance algorithm
-- ---------------------------------------------------------------------------
-- Levenshtein distance
-- from the Artful Common Queries page
-- http://www.artfulsoftware.com/infotree/qrytip.php?id=552
-- ---------------------------------------------------------------------------
-- The Levenshtein distance between two strings is the minimum number of
-- operations needed to transform one string into the other, where an operation
-- may be insertion, deletion or substitution of one character.
//Download remote file
function getUrlFile($url, $path)
{
$newfilename = $path;
$file = fopen($url, "rb");
if ($file) {
$newfile = fopen($newfilename, "wb");
if ($newfile)
while (!feof($file)) {
fwrite($newfile, fread($file, 1024 * 8), 1024 * 8);
document.getElementById("header").style.top = 0;
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
document.getElementById("header").style.position = 'fixed';
var currentScrollPos = window.pageYOffset;
var htop = parseInt(document.getElementById("header").style.top);
var menuHeight = $('header').outerHeight()+5;
if (prevScrollpos > currentScrollPos) {
htop = htop +3;
.wrap
{
height: 100%;
width: 100%;
position: fixed;
padding-top: 104px;
left: 0;
z-index: 99;
top:-100%;
}