Skip to content

Instantly share code, notes, and snippets.

View nixon1333's full-sized avatar
Moving Fast

Ashraful Islam Nixon nixon1333

Moving Fast
View GitHub Profile
@nixon1333
nixon1333 / ddslick select by value
Created August 24, 2014 05:58
Select ddslick option by value or text
$('#currencySelectBox li').each(function( index ) {
var currs = $( this ).find('.dd-option-value').val();
if(currs == storeCur)
{
$('#currencySelectBox').ddslick('select', {index: $(this).index()});
}
});
@nixon1333
nixon1333 / phalcon session 101
Last active August 29, 2015 14:05
basic session usage in php strom
//check a session
if ($this->session->has("loggedIn")) {
//remove a session varaiable
$this->session->remove("loggedIn");
}else{
//add a session variable
$this->session->set("loggedIn", '1');
}
@nixon1333
nixon1333 / phalconPost.php
Created August 27, 2014 05:54
grab the post request in phalcon framework, controller
if ($this->request->isPost() == true) {
// Access POST data
$customerName = $this->request->getPost("name");
$customerBorn = $this->request->getPost("born");
}
@nixon1333
nixon1333 / resource.php
Created August 27, 2014 12:57
load css,js,image in phalcon
<?php echo Phalcon\Tag::stylesheetLink("css/local.css"); ?>
<?php echo Phalcon\Tag::image("img/stsllc_logo.png");?>
<?php echo Phalcon\Tag::javascriptInclude("js/jquery-1.10.2.min.js");?>
@nixon1333
nixon1333 / errorController.php
Created August 31, 2014 06:37
phalcon framework: pick any view from any controller
//pick the 404 page from view folder
$this->view->pick('404/404');
@nixon1333
nixon1333 / AdminController.php
Created September 2, 2014 06:32
phalcon - model join query
$robots = Category::query()
->columns(array('Category.id', 'Category.cate_name', 'Tags.tag_name'))
->join('Tags', 'Category.id = Tags.tag_ref_id')
->execute();
<?php
/* The loop */
if ( get_post_gallery() ) :
$gallery = get_post_gallery( $post, false );
?>
<div class="sliderss">
<a href="javascript:" class="pera-close"></a>
<?php
/* Loop through all the image and output them one by one */
<html>
<body>
<form action="result.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
@nixon1333
nixon1333 / email_domain.php
Created November 6, 2014 10:43
simple solution for extracting domain name in php
<?php
$email = '[email protected]';
//get the domain here
$domain = array_pop(explode('@', $email));
?>