Skip to content

Instantly share code, notes, and snippets.

@localdisk
localdisk / plugin_loader.js
Created August 26, 2015 06:51
plugin_loader.js
/* {{{
Copyright (c) 2008, anekos.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@localdisk
localdisk / services.php
Created September 12, 2015 09:21
laravel socialite twitter
<?php
return [
'twitter' => [
'client_id' => env('TWITTER_CLIENT_ID'),
'client_secret' => env('TWITTER_CLIENT_SECRET'),
'redirect' => 'http://127.0.0.1:8000/auth/twitter/callback',
],
];
@localdisk
localdisk / routes.php
Created September 12, 2015 09:24
Laravel Socialite Twitter
<?php
Route::get('/', function () {
if (!Auth::check()) {
// ログイン済でなければリダイレクト
$url = url('auth/twitter');
$text = 'twitter でログイン';
return 'こんにちは ゲストさん. ' . '<a href="' . $url . '">' . $text . '</a>';
}
@localdisk
localdisk / bower.json
Last active November 20, 2015 12:27
フロントエンド片手間ンによる Laravel Elixir 入門 ref: http://qiita.com/localdisk/items/72bcbe71734253d1416f
{
"name": "Laravel Application",
"dependencies": {
"bootstrap-sass-official": "~3.3.1",
"font-awesome": "~4.2.0"
}
}
@localdisk
localdisk / gist:84ea12bf89938d9190eb
Created November 26, 2015 23:05
viChrome settings
### Sample Settings
# aliases
# in this example you can open extensions page by the command ':ext'
# and Chrome's option page by the command ':option'
alias ext TabOpenNew chrome://extensions/
alias option TabOpenNew chrome://settings/browser
alias downloads TabOpenNew chrome://downloads
alias history TabOpenNew chrome://history
@localdisk
localdisk / gist:5864130
Created June 26, 2013 01:47
Hello Laravel!
<?php
Route::get('/', function()
{
return 'Hello Laravel!';
});
@localdisk
localdisk / gist:6503902
Last active December 22, 2015 17:09
Confide のリソースファイルを日本語化しました。
<?php
return array(
// 'username' => 'Username',
'username' => 'ユーザー名',
// 'password' => 'Password',
'password' => 'パスワード',
// 'password_confirmation' => 'Confirm Password',
'password_confirmation' => 'パスワードの確認',
@localdisk
localdisk / html_macros.php
Last active December 31, 2015 02:39
Laravel4 HTML macros.
<?php
// env == local の場合 noindex, nofollow する
HTML::macro('follow', function() {
if (App::environment() === 'local') {
return PHP_EOL . '<meta name="robots" content="noindex,nofollow" />';
}
return '';
});
// 配列を分解して keywords にセット
HTML::macro('keywords', function($keywords) {
@localdisk
localdisk / routes.php
Last active January 1, 2016 16:09
Laravel Transaction Example
<?php
Route::post('save', function() {
$user = new User;
$user->username = 'foo';
$user->password = Hash::make('password');
$user->email = 'foo@bar.com';
DB::transaction(function() use ($user) {
$user->save();
});
@localdisk
localdisk / filters.php
Created January 10, 2014 03:07
Laravel 4 CSRF on all POST requests
<?php
App::before(function($request)
{
// POST / PUT / DELETE / PATCH also included You can use the $request-> getRealMethod()
if ($request->getMethod() === 'POST') {
Route::callRouteFilter('csrf', [], '', $request);
}
});