Skip to content

Instantly share code, notes, and snippets.

@vikky410
vikky410 / eloquentConnection.php
Last active August 29, 2015 14:13
Eloquent connection as 3rd party
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule = new Capsule;
$capsule->addConnection([
"driver" => "mysql",
"host" => "localhost",
"database" => "slim",
"username" => "root",
@vikky410
vikky410 / plugin-init.php
Last active August 29, 2015 14:08
WP: Plugin Init Code
<?php
/*
Plugin Name: My Plugin
Plugin URI: http://example.com/wordpress-plugins/my-plugin
Description: A brief description of my plugin
Version: 1.0
Author: Author Name
Author URI: http://example.com
License: GPLv2
*/
@vikky410
vikky410 / define-angular-module.html
Last active August 29, 2015 14:08
JS: Angular-module-define
var myApp = angular.module('myApp',[]);
myApp.controller('CartController', function($scope){
// Logic goes here
});
@vikky410
vikky410 / angular.html
Created November 6, 2014 07:51
JS: angular template
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title Page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.24/angular.min.js"></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
@vikky410
vikky410 / genesis-remove-site-desc.php
Last active August 29, 2015 14:07
wp:genesis remove site description
/**
* Remove the site description
* Put it into child theme functions.php
*/
remove_action ('genesis_site_description','genesis_seo_site_description' );
@vikky410
vikky410 / functions.php
Created October 18, 2014 12:41
Wp: genesis functions.php
<?php
// Start the engine
require_once( get_template_directory() . '/lib/init.php' );
// Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
// Add Viewport meta tag for mobile browsers
add_action( 'genesis_meta', 'sample_viewport_meta_tag' );
@vikky410
vikky410 / wp-style.css
Last active August 29, 2015 14:07
Wp: genesis style css
/*
Theme Name: Theme Name
Description: This is the sample theme created for the Genesis Framework.
Author: Author name
Author URI:
Version: 1.9
Tags: black, orange, white, one-column, two-columns, three-columns, fixed-width, custom-menu, full-width-template, sticky-post, theme-options, threaded-comments, translation-ready
@vikky410
vikky410 / form-field.blade.php
Created October 17, 2014 04:28
Laravel4: Form Field
{{
Form::field([
"type" => "text",
"name" => "atrributeName",
"label" => "LabelName",
"form" => $form,
"placeholder" => "placeholder",
"value" => $group->valueName
])
}}
@vikky410
vikky410 / laravel-form-horizontal.blade.php
Created October 17, 2014 04:23
Laravel4: Form initilize - Blade
{{ Form::open(array('action' => 'NameController@actionName', 'class' => 'form-horizontal' , 'role' => 'form')) }}
{{ Form::submit('Save', array('class' => 'btn btn-success btn-small')) }}
{{ Form::close() }}
@vikky410
vikky410 / yii-strong-password.php
Created October 16, 2014 12:49
Yii1: strong password in user model
<?php
public function passwordStrengthOk($attribute, $params)
{
// default to true
$valid = true;
// at least one number
$valid = $valid && preg_match('/.*[\d].*/', $this->$attribute);
// at least one non-word character
$valid = $valid && preg_match('/.*[\W].*/', $this->$attribute);
// at least one capital letter