Skip to content

Instantly share code, notes, and snippets.

View kbirmhrjn's full-sized avatar

World Warcraft kbirmhrjn

  • Aukland, Newzeland
View GitHub Profile
<?php
/**
* Dump helper. Functions to dump variables to the screen, in a nicley formatted manner.
* @author Joost van Veen
* @version 1.0
*/
if (!function_exists('dump')) {
function dump ($var, $label = 'Dump', $echo = TRUE)
{
// Store dump in variable
<?php
class MatchesControllerTest extends TestCase
{
protected $user;
protected $profile;
public function setUp()
{
parent::setUp();
DB::beginTransaction();
@kbirmhrjn
kbirmhrjn / TestCase.php
Created January 6, 2014 07:55
TestCase
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
/**
* Creates the application.
*
* @return Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
@kbirmhrjn
kbirmhrjn / Matches_all_in_one.php
Last active January 2, 2016 08:59
Whenever I run phpunit, I get undefined $matches_lastupdate ? can't test properly by this
//Routes.php
Route::get('/matches',['uses' => 'MatchesController@index']);
//BaseController.php
BaseController extends Controller{
function __construct()
{
// call task for update cloudsearch if there are updated gigmor profiles
// not best place to do it.
CloudSearch::updateProfiles();
@kbirmhrjn
kbirmhrjn / Laravel Resources
Last active December 6, 2023 23:05
List of Laravel Resources:
1. laravel.com/docs
2. laravel.io
3. laravel-tricks.com
4. laracasts.com
5. laravel-recipes.com
6. cheats.jesse-obrien.ca
7. laravelweekly.com
8. http://fideloper.com
9. http://jasonlewis.me
10. http://culttt.com/search/?q=laravel
@kbirmhrjn
kbirmhrjn / Learning Resources
Created January 7, 2014 16:50
Resources for learning tons of stuffs!
http://tutorialzine.com/
http://teamtreehouse.com/dashboard https://tutsplus.com/
http://hub.tutsplus.com/
http://www.codeschool.com/ https://peepcode.com/screencasts
http://www.udemy.com/
http://learncodethehardway.org/
http://www.programr.com/
http://www.codecademy.com/#!/exercises/0
http://www.bloc.io/
https://www.phpacademy.org/
#!/usr/bin/env bash
# Upgrade Base Packages
sudo apt-get update
sudo apt-get upgrade -y
# Install Web Packages
sudo apt-get install -y build-essential dkms re2c apache2 php5 php5-dev php-pear php5-xdebug php5-apcu php5-json php5-sqlite \
php5-mysql php5-pgsql php5-gd curl php5-curl memcached php5-memcached libmcrypt4 php5-mcrypt postgresql redis-server beanstalkd \
openssh-server git vim python2.7-dev
@kbirmhrjn
kbirmhrjn / SQLQuery.php
Last active January 4, 2016 02:19
Query Executed
//Debugging through
//Band > music > likes > user
"select * from `band_profile` where `id` = ? limit 1"
"select * from `music_asset` where `music_asset`.`profile_id` = ? and `music_asset`.`profile_type` = ? and `type` = ?"
"select * from `likes` where `likes`.`object_id` = ? and `likes`.`object_type` = ?"
"select * from `likes` where `likes`.`object_id` = ? and `likes`.`object_type` = ? and `user_id` = ? limit 1"
4 query run @ combined
| PHP | 5.4 | 5.5 | Mention date | PHP version information link
+----------------------+-----+-----+--------------+------------------------------------------------------------------------
| justHost.com | X | | 2013-09-06 | https://my.justhost.com/cgi/help/447
| NetworkSolutions | X | | 2013-03-17 | http://forums.networksolutions.com/index.php?showtopic=10601&mode=linearplus
| BlueHost | X | | Today? | https://my.bluehost.com/cgi/help/php-version
| HostGator | X | X | Today | https://support.hostgator.com/articles/hosting-guide/hardware-software/what-version-of-php-are-you-using
| 1&1 | X | X | Today | http://www.1and1.com/details-php-programming
| FatCow | X | | ? | http://www.mybestwebhostingsites.com/details/fatcow-wordpress/
| Hub | X | | 2012-04-17 | http://www.webhostinghub.com/help/news/archive-announcements/php-5-4
| G
//required it in global.php
Validator::extend('alpha_spaces', function($attribute, $value)
{
return preg_match('/^[\pL\s]+$/u', $value);
});
// use it as usual:
$rules = array('name' => 'required|alpha_spaces');