Skip to content

Instantly share code, notes, and snippets.

View sineld's full-sized avatar
🏢
Full Stack Developer

Sinan Eldem sineld

🏢
Full Stack Developer
View GitHub Profile
@sineld
sineld / class.phpmailer.php
Created August 13, 2013 06:59
Mandrillapp ile Phpmailer
<?php
/*~ class.phpmailer.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.2.1 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) [email protected] |
| : Marcus Bointon (coolbru) [email protected] |
@sineld
sineld / .bashrc
Last active December 20, 2015 14:19
Linux Kısayolları # chmod +x fy.sh # sh fy.sh
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
# User specific aliases and functions
<?php
/**
* @copyright 2012 TheHydroImpulse, Daniel Fagnan
* @version 0.1
* @todo Add an overwite ability. Among other things.
* @note Use this as you wish. Extend it, Mash it. Enjoy it.
*/

Sentry is an amazing auth system. But I really need a feature: multiple user types in the same app. And I cannot separate those in groups, because they have different table columns. After 2 days burning my head, I think I found a good solution. The magic is duplicate SentryServiceProvider with new different settings.

Lets suppose we have a fresh Sentry install with default User ambient. Now we want another ambient called Admin, with new model and different settings. How to do:

1. One model, one ambient

Let's create one model called Admin for our new ambient.

<?php
### --- Snip --- ###
App::after(function($request, $response)
{
// HTML Minification
if(App::Environment() != 'local')
{
if($response instanceof Illuminate\Http\Response)
@sineld
sineld / configFromDatabase.php
Created July 11, 2013 05:16
Get Config from database
<?php
// http://forums.laravel.io/viewtopic.php?id=10406
// filename: app/config/settings.php
$list = array();
$format = function(&$list, $keys, $val) use(&$format) {
$keys ? $format($list[array_shift($keys)], $keys, $val) : $list = $val;
};
@sineld
sineld / sublimeText2-3.settings
Last active December 19, 2015 13:49
sublimeText2-3.settings
{
"auto_complete": true,
"auto_complete_selector": "source, text",
"color_scheme": "Packages/Dayle Rees Color Schemes/FreshCut.tmTheme",
"ensure_newline_at_eof_on_save": false,
"fallback_encoding": "Turkish (Windows 1254)",
"folder_exclude_patterns":
[
".svn",
".hg",
@sineld
sineld / select_lang.php
Created July 6, 2013 05:14
Localisation gone wrong?
<?php
// http://forums.laravel.io/viewtopic.php?pid=45912#p45912
First of all, thank you for asking this question, looking into it made me understand things a lot better. As it turns out, you can also use parameters for prefixes in route groups. Using a filter, you can then obtain the value of all parameters (so including the prefix of the route group). What you'll want to do is create a filter (best put in filters.php):
[code]
Route::filter('select_lang', function($route)
{
// do check that the lang parameter is valid!
App:setLocale($route->getParameter('lang'));
});
[/code]

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
*
* @author Barry vd. Heuvel <[email protected]>
*/
namespace {
die('Only to be used as an helper for your IDE');
}