Skip to content

Instantly share code, notes, and snippets.

View cAstraea's full-sized avatar

cAstraea

View GitHub Profile
@drakakisgeo
drakakisgeo / gist:48dcab1539612c82449b9757940ac7ee
Last active August 29, 2022 02:41
Print Access Token from Laravel Passport
<?php
namespace App\Traits;
use App\User;
use DateTime;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
use Laravel\Passport\Bridge\AccessTokenRepository;
@archy-bold
archy-bold / ExamplePassportTest.php
Last active October 15, 2022 03:49
Testing Passport Authenticated Controllers and Routes in Laravel
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExamplePassportTest extends \PassportTestCase
{
use DatabaseTransactions;
@ebruning
ebruning / gist:6084205
Created July 25, 2013 22:03
Restart application
http://stackoverflow.com/questions/5082738/ios-calling-app-delegate-method-from-viewcontroller
http://stackoverflow.com/questions/4399611/force-iphone-app-to-restart-programmatically
// call delegate method
MainClass *appDelegate = (MainClass *)[[UIApplication sharedApplication] delegate];
[appDelegate.viewController resetAppToFirstController];
- (void)resetAppToFirstController
{
@messi89
messi89 / PassportToken.php
Last active April 4, 2023 12:08
Laravel Passport getBearerTokenByUser (Get AccessToken from User) - Laravel 6.x updated
<?php
namespace App\Traits;
use DateTimeImmutable;
use Laravel\Passport\Bridge\Scope;
use Modules\User\Models\User;
use GuzzleHttp\Psr7\Response;
use Illuminate\Events\Dispatcher;
use Laravel\Passport\Bridge\AccessToken;
@aeurielesn
aeurielesn / util.php
Created July 31, 2011 03:47
Decode Unicode strings in PHP
<?php
#source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}
@linxlad
linxlad / FormErrorsSerializer.php
Last active August 18, 2023 11:20 — forked from Graceas/FormErrorsSerializer.php
Symfony 2 Form Error Serializer. May be used for AJAX form validation. Allows tree and flat array styles for errors.
<?php
namespace OpenObjects\Bundle\CoreBundle\Service;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormError;
use Symfony\Component\Validator\ConstraintViolation;
/**
@ralphcrisostomo
ralphcrisostomo / array_dupplicate_counter.js
Created July 19, 2012 07:43
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@meigwilym
meigwilym / index.md
Created November 28, 2019 08:52
Notes on stitcher.io's Laravel beyond CRUD

Laravel beyond CRUD

stitcher.io

A blog series for PHP developers working on larger-than-average Laravel projects

Written for projects with a development lifespan of six to twelve months, with a team of three to six developers working on them simultaneously.

Chapter 1: Domain oriented Laravel

anonymous
anonymous / dev_jobs_in_japan.md
Created September 16, 2016 04:34
Software dev jobs in Japan

Companies

  • Github - Recently started hiring developers in Tokyo
  • Heroku - Infrastructure-as-a-service; recently bought by Salesforce
  • Pivotal Labs - Recently started hiring developers in Tokyo; nice Mori Tower office
  • Google - Consistently ranked best place in Japan to work; nice Mori Tower office
  • Amazon - I THINK they now hire some developers
  • Microsoft - English-friendly with chances to speak Japanese; apparently have some interesting projects; nice Shinagawa office
  • Kaizen Platform - Pretty awesome company developing A/B testint as a service / analytics services; I think most people there speak English; has an office in San Francisco
  • [Treasure Data](https://www.treasureda
@Ocramius
Ocramius / User.php
Last active February 16, 2024 14:57
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User