Skip to content

Instantly share code, notes, and snippets.

View abdullahbutt's full-sized avatar

Abdullah Butt abdullahbutt

  • Fulda, Deutschland
View GitHub Profile
@abdullahbutt
abdullahbutt / big.php
Created January 30, 2014 14:48
ajax call sample
function fetchFilteredRecords(val)
{
if(val=="custom")
{
$("#custom_filtering").show();
}
else
{
@abdullahbutt
abdullahbutt / selectively dumping data with mysqldump
Last active August 29, 2015 13:56
selectively dumping data with mysqldump
Selectively dumping data with mysqldump
http://www.electrictoolbox.com/mysqldump-selectively-dump-data/
mysqldump is a command line tool for outputting table structures and data and can be used for backups etc. By default mysqldump will dump all data from a table, but it is possible to select which data to be exported with mysqldump. This post looks at how to do this.
The examples in this post have a table called "mytable" in a database called "test". mytable has three columns: mytable_id, category_id and name, and we will be selectively exporting data that matches a specific category_id.
Using mysqldump to dump all data from the table would look like this, subsituting [username] for your username (the -t flag suppresses the table creation sql from the dump):
@abdullahbutt
abdullahbutt / add border to font
Created February 21, 2014 12:29
how to add a border to your font
how to add a border to your font.
The right answer is:
#element {
color: yellow;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
@abdullahbutt
abdullahbutt / datepicker maxDate & minDate
Last active August 29, 2015 13:56
jquery datepicker maxdate or maxDate and mindate or minDate
maxDateType: Date or Number or String
Default: null
The maximum selectable date. When set to null, there is no maximum.
Multiple types supported:
• Date: A date object containing the maximum date.
• Number: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.
• String: A string in the format defined by the dateFormat option, or a relative date. Relative dates must contain value and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.
Code examples:
Initialize the datepicker with the maxDate option specified:
1 $( ".selector" ).datepicker({ maxDate: "+1m +1w" });
@abdullahbutt
abdullahbutt / placeholder using jquery
Last active August 29, 2015 13:57
placeholder using jquery
<script src="js/jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function()
{
$('#password').attr('placeholder','Password');
$('#email').attr('placeholder','E-mail');
});
</script>
@abdullahbutt
abdullahbutt / regex backslash
Created March 23, 2014 02:26
regular expressions backslash sequences
Backslash sequences
regular expressions backslash sequences
A backslash sequence is a sequence of characters, the first one of which is a backslash. Perl ascribes special meaning to many such sequences, and some of these are character classes. That is, they match a single character each, provided that the character belongs to the specific set of characters defined by the sequence.
Here's a list of the backslash sequences that are character classes. They are discussed in more detail below. (For the backslash sequences that aren't character classes, see perlrebackslash.)
@abdullahbutt
abdullahbutt / regex
Created March 23, 2014 02:12
regular expressions character classes and other special escapes
Sequence Note Description
[...] [1] Match a character according to the rules of the
bracketed character class defined by the "...".
Example: [a-z] matches "a" or "b" or "c" ... or "z"
[[:...:]] [2] Match a character according to the rules of the POSIX
character class "..." within the outer bracketed
character class. Example: [[:upper:]] matches any
uppercase character.
(?[...]) [8] Extended bracketed character class
\w [3] Match a "word" character (alphanumeric plus "_", plus
@abdullahbutt
abdullahbutt / get and delete last word in URL
Last active August 29, 2015 13:58
get last word in URL and delete what is not necessary
get last word in URL and delete what is not necessary
if in $last_word you find also -0.htm then delete -0.htm
I explain my $last_word now shows test-0.htm
But I do not need -0.htm
I only need "test".
How do I say in PHP to delete -0.html and to grab only "test".
$last_word="-0.html";
@abdullahbutt
abdullahbutt / ol li left align
Created April 15, 2014 13:01
ol li have left margin and can't left align
ol li have left margin and can't left align
Solution:
<style type="text/css">
ol, ol li { margin-left:0; padding-left:0; list-style-position:inside;}
</style>
@abdullahbutt
abdullahbutt / html character entities
Created April 19, 2014 05:46
useful html character entities
Useful HTML Character Entities
Result Description Entity Name Entity Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;