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
//installs "packagename" latest version | |
composer require vendorname/packagename | |
//installs package version 1.2 | |
composer require vendorname/packagename 1.2 | |
//installs package version above 1.2 but lesser then 2.0 | |
composer require vendorname/packagename 1.2.* | |
//installs package version above 1.2 but lesser then 2.0 |
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
var input_string = document.getElementById('my-input').innerText; | |
var output_element = document.getElementById('my-output'); | |
//here we go | |
var right_text = input_string.substring(0, input_string.indexOf(":")); | |
output_element.innerText = right_text; |
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
String.prototype.map_replace = function (values) { | |
var string = this, key; | |
for (key in values) { | |
string = string.replace(new RegExp('\\{' + key + '\\}', 'gm'), values[key]); | |
} | |
return string | |
} | |
//usage |
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
jQuery.fn.messagePlugin = function(){ | |
var selectedObjects = this; | |
return { | |
saySomething : function(message){ | |
$(selectedObjects).each(function(){ | |
$(this).html(message); | |
}); | |
return selectedObjects; // Preserve the jQuery chainability | |
}, | |
anotherAction : function(){ |
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
<?PHP | |
$my_URL="http://some-website.com/mydata.txt"; | |
$lines = file($my_URL); | |
foreach ($lines as $line_num => $line) | |
{ | |
echo $line_num." ".$line; | |
} | |
?> |
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
#container { | |
overflow: hidden; | |
width: 100%; | |
} | |
#left-col { | |
float: left; | |
width: 50%; | |
background-color: orange; | |
padding-bottom: 500em; | |
margin-bottom: -500em; |
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
// Storing a single value works fine with define | |
define( 'ROOT_DIR', dirname(dirname(__FILE__)) . '/' ); | |
// But not for complex data types like this array | |
$USERPIC_PARAMS = array( | |
"user_root" => "images/users", | |
"padding_length" => 8, | |
"split_length" => 4, | |
"hash_length" => 12, | |
"hide_leftover" => false |
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
npm ls -g --depth 0 |
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
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^example\.com [NC] | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://example.com/$1 [R,L] |
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
#Force SSL | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |