Skip to content

Instantly share code, notes, and snippets.

View naneri's full-sized avatar
👔

Kana naneri

👔
View GitHub Profile
@naneri
naneri / Dump the $variable
Last active August 29, 2015 14:02
Dumps the $variable and displays it nicely. After that finishes the script. This Gist can be set as a code snippet in Netbeans / Notepad++ / Any other editor, so that it can be used to quickly find out, what is inside the variable.
echo "<pre>"; print_r($variable); echo "</pre>";
exit;
@naneri
naneri / likelist.php
Last active August 29, 2015 14:12
Facebook print likes list
<?php
header('Content-type: text/plain; charset=utf-8');
//declare the number of the post/photo in the $post_nmuber variable
$post_number = '';
$list = file_get_contents('http://graph.facebook.com/v1.0/' . $post_number . '/likes?pretty=1&limit=600&after=MTAwMDAyNTI4ODAyMDYx');
$array = json_decode($list);
foreach($array->data as $user){
<?php
class TopicCommentsController extends \BaseController {
...
public function index()
{
$topiccomments = Topiccomment::all();
return View::make('topiccomments.index', compact('topiccomments'));
<?php
// app/config/app.php
return array(
....
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
<?php
class BaseController extends Controller{
...
public function setLocale($locale = Null)
{
if(!$locale){
$mLocale = Config::get( 'app.locale' );
}
$mLocale = $locale; // Get parameter from URL.
<?php
class BaseController extends Controller{
...
/**
* setting up the locale
* @param [type] $locale - the parameter from the URL with the locale
*/
public function setLocale($locale = Null)
{
<?php
// app/routes.php
Route::get('locale/{locale}', 'BaseController@setLocale' );
<?php
// app/filters.php
App::before(function($request)
{
// Set default locale.
$mLocale = Config::get( 'app.locale' );
// Has a session locale already been set?
if ( !Session::has( 'locale' ) )
{
<?php
class UsersTableSeeder extends Seeder{
public function run(){
DB::table('users')->delete();
$faker = Faker\Factory::create();
for ($i = 0; $i < 100; $i++)
<?php
class CompaniesTableSeeder extends Seeder {
public function run()
{
DB::table('companies')->delete();
$faker = Faker\Factory::create();