This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// | |
// A collection of function for advanced type checking | |
// @author Hugo Giraudel | |
// @ref https://gist.github.com/HugoGiraudel/2933ef053ae0bf70ad8b | |
//// | |
@function is-number($value) | |
@return type-of($value) == "number" | |
@function is-time($value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function breakpointWidth() { | |
var theWidth = $(window).width(), | |
theTitle = $('title'); | |
theTitle.empty(); | |
theTitle.html(theWidth + 'px wide '); | |
} | |
$(window).resize(function() { | |
breakpointWidth(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).load(function() { //start after HTML, images have loaded | |
var InfiniteRotator = | |
{ | |
init: function() | |
{ | |
//initial fade-in time (in milliseconds) | |
var initialFadeIn = 1000; | |
//interval between items (in milliseconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$lines = file('http://google.com/'); // pick the url | |
foreach ($lines as $line_num => $line) { | |
// loop thru each line and prepend line numbers | |
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Connect to the local database server as user root | |
# You will be prompted for a password. | |
# | |
mysql -h localhost -u root -p | |
# | |
# Now we see the 'mysql>' prompt and we can run | |
# the following to create a new database for Paul. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); //implicitly creates file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); //open file for writing ('w','r','a')... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'r'); | |
$data = fread($handle,filesize($my_file)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file); | |
$data = 'This is the data'; | |
fwrite($handle, $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'a') or die('Cannot open file: '.$my_file); | |
$data = 'New data line 1'; | |
fwrite($handle, $data); | |
$new_data = "\n".'New data line 2'; | |
fwrite($handle, $new_data); |
NewerOlder