Skip to content

Instantly share code, notes, and snippets.

View a9un9hari's full-sized avatar

Agung Hari Wijaya a9un9hari

View GitHub Profile
@a9un9hari
a9un9hari / centerBackground.css
Created August 15, 2013 07:18
center background
background: url(url_path) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
@a9un9hari
a9un9hari / paragraphFunction.php
Created August 14, 2013 09:44
PHP get first paragraph from a string function
<?php
function getFirstPara($string){
$string = substr($string,0, strpos($string, "</p>")+4);
return $string;
}
// If you wanted to remove the paragraph tags from the HTML
function getFirstPara2($string){
$string = substr($string,0, strpos($string, "</p>")+4);
$string = str_replace("<p>", "", str_replace("<p/>", "", $string));

Direktori L3. Saya berasumsi anda telah menginstall composer. Bisa dalam bentuk bin atau hasil download dari http://getcomposer.org/composer.phar.

Saya kasih contoh dengan menggunakan composer.phar dan letakkan file tersebut seperti ini.

/application  
/bundles	
/laravel	
/public	
/storage	
if this not working
<!--[if IE]>
<![endif]-->
try this
var ieVersion = /*@cc_on (function() {switch(@_jscript_version) {case 1.0: return 3; case 3.0: return 4; case 5.0: return 5; case 5.1: return 5; case 5.5: return 5.5; case 5.6: return 6; case 5.7: return 7; case 5.8: return 8; case 9: return 9; case 10: return 10;}})() || @*/ 0;
if (ieVersion != 0) {
//here
};
mysql> SELECT * FROM articles WHERE MATCH (title,body)
-> AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+----+-----------------------+-------------------------------------+
| id | title | body |
+----+-----------------------+-------------------------------------+
| 1 | MySQL Tutorial | DBMS stands for DataBase ... |
| 2 | How To Use MySQL Well | After you went through a ... |
| 3 | Optimizing MySQL | In this tutorial we will show ... |
| 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... |
| 6 | MySQL Security | When configured properly, MySQL ... |
@a9un9hari
a9un9hari / ajaxexample.js
Last active December 20, 2015 07:59
Basic usage of .ajax
// variable to hold request
var request;
// bind to the submit event of our form
$("#foo").submit(function(event){
// abort any pending request
if (request) {
request.abort();
}
// setup some local variables
var $form = $(this);
@a9un9hari
a9un9hari / Style Placeholder Text
Created July 24, 2013 16:41
Placeholder text in inputs has (in the browsers implementing it so far) a light gray color. To style it, you'll need vendor prefix CSS properties. IE Docs -> http://msdn.microsoft.com/en-us/library/ie/hh772745%28v=vs.85%29.aspx MDN Docs -> https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-placeholder?redirectlocale=en-US&redirectslug=CSS%2F…
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
::-moz-placeholder { /* Firefox 19+ */
color: red;
git reset HEAD <File>
git config --global alias.unstage 'reset HEAD --'
get unstage <file>
<?php
class foo
{
function do_foo()
{
echo "Doing foo.";
}
}
$bar = new foo;
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);