Skip to content

Instantly share code, notes, and snippets.

View harikt's full-sized avatar
⛱️
Tanvish Technologies

Hari K T harikt

⛱️
Tanvish Technologies
View GitHub Profile
@harikt
harikt / cookie1.php
Created May 15, 2014 08:24
Something is wrong. But now working fine
<?php
if (isset($_COOKIE['counter'])) {
$counter = $_COOKIE['counter'];
echo $counter;
$counter++;
setcookie('counter', $counter, time() + 60*60*24*30, '/', '', false, true);
} else {
setcookie('counter', 1, time() + 60*60*24*30, '/', '', false, true);
}
// Lifted from https://stackoverflow.com/a/22103222
if (typeof console === "undefined" || typeof console.log === "undefined") {
console.log = function(msg) {
alert(msg);
};
}
@harikt
harikt / LoginAction.php
Created June 24, 2014 15:40
User bundle login action. Where will the redirect goes in ADR .
<?php
namespace Hari\User_Bundle\Action;
use Aura\Web\Request;
use Hari\User_Bundle\Input\LoginForm;
use Hari\User_Bundle\Responder\LoginResponder;
use Aura\Auth\Adapter\AbstractInterface as AuthAdapter;
use Aura\Auth\User;
class LoginAction extends AbstractUserAction
<?php
$di->params['Aura\Asset_Bundle\AssetService'] = array(
'map' => array(
'hari/user-bundle' => dirname(__DIR__) . '/web'
),
);
$di->params['Aura\Asset_Bundle\AssetService'] = array(
'types' => array(),
);
<?php
namespace Hello;
class World
{
public function display()
{
return imap_connect('imap.example.com');
}
}
<?php
namespace Hello;
class World
{
public function display()
{
return imap_connect('imap.example.com');
}
}
@harikt
harikt / modify-calling-dispatcher-and-router.php
Last active August 29, 2015 14:04
In first example the `modify()` is calling the `modifyWebRouter()` and `modifyWebDispatcher()` .
<?php
namespace Aura\Framework_Project\_Config;
use Aura\Di\Config;
use Aura\Di\Container;
class Common extends Config
{
public function define(Container $di)
{
{
"require": {
"aura/sql": "~2.0.0",
"aura/sqlquery": "~2.0.0"
}
}
@harikt
harikt / traceback.py
Created July 25, 2014 13:38
How to make the exception string without new line character ?
import sys, traceback
def func1():
try:
raise Exception
except:
# print (" %s " % sys.exc_info()[0])
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
print ''.join(line.strip() + ' ' for line in lines)
@harikt
harikt / blog.sql
Created July 28, 2014 15:47
The database that supporting my experiments https://github.com/harikt/experiments
-- Adminer 4.1.0 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `authors`;
CREATE TABLE `authors` (
`id` varchar(255) NOT NULL,