Skip to content

Instantly share code, notes, and snippets.

View tolu360's full-sized avatar
💭
Hacking on lotta awesomeness!

Tolu Olowu tolu360

💭
Hacking on lotta awesomeness!
View GitHub Profile
@tolu360
tolu360 / ApiRenderer.php
Created September 8, 2023 15:03 — forked from JustSteveKing/ApiRenderer.php
Handling Errors in Laravel
<?php
declare(strict_types=1);
namespace App\Exceptions\Rendering;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
/**
* --------------------
* ReactotronSlowlog.js
* --------------------
*
* A Reactotron plugin for react-native-slowlog by Dotan J. Nahum.
*
* https://github.com/jondot/react-native-slowlog
*
* --- PRE-REQUESTS ---
Ionic and ngCordova upload example

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
<?php namespace Forge;
class PrettyName {
/**
* An array of adjectives.
*
* @var array
*/
protected static $adj = [
<?php
use Faker\Factory as Faker;
class ApiTester extends TestCase {
/**
* @var Faker
*/
protected $fake;
@tolu360
tolu360 / upload.php
Created February 25, 2014 17:38 — forked from msurguy/upload.php
ini_set("memory_limit","200M");
if( !empty($_SERVER['HTTP_ORIGIN']) ){
// Enable CORS
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Range, Content-Disposition, Content-Type');
}
if( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ){

My Validation Base Class

I was asked how I deal with validation / create and update validation rulesets. Well here is one method I have used. Don't be afraid to build on top of what the framework has already given you. In my projects I use a base class for almost anything. You never know when you want your classes to inherit some common functionality. My BaseValidator actually has some pretty useful methods and properties in it.

<?php

namespace FooProject\Internal\Validators;

use FooProject\Internal\Sanitizers\BaseSanitizer;
@tolu360
tolu360 / spinner.css
Last active December 24, 2015 02:19 — forked from jkneb/spinner.css
/*
* Read more here:
* http://front-back.com/a-cool-css-spinner-with-less-variables
*/
/*
* This is a nice full CSS3 loader made with LESS
* so you'll have to compile it into CSS to make it work in your project
* See the doc on the LESS website : http://lesscss.org/
*/
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");