Skip to content

Instantly share code, notes, and snippets.

Rizqi Djamaluddin rizqidjamaluddin

View GitHub Profile
View test.ts
import {expect} from "chai";
import {PandoraContainer} from "../../src/container/pandora.container";
import {BindingNotFoundException} from "../../src/container/support/binding-not-found.exception";
import {Inject} from "../../src/container/inject";
export function start(): PandoraContainer {
return new PandoraContainer;
}
export class Foo {
View gist:ace7ca4881c5ae1e0478970148dea355
FROM php:7.1-fpm
RUN apt-get update && apt-get install -y \
curl \
libssl-dev \
zlib1g-dev \
libicu-dev \
libmcrypt-dev \
libmagickwand-dev \
libmagickcore-dev
View mlist.php
<?php
$file = fopen("src.txt", 'r');
$out = fopen("result.csv", 'w');
fputcsv($out, ['first_name', 'last_name', 'address', 'city', 'state', 'zip']);
$buffer = [];
$counter = 0;
View simple-contract.md

Contract Elements

Description of Services

  • List services rendered
  • Explicitly state that services are limited to the following deliverables, and any change to either services or deliverables will necessitate a new or appended contract

Deliverables

  • List every kind of deliverable: digital files, media files etc
View Admin.php
<?php
// this is another kind of user.
class Admin extends Model {
protected $fillable = ['public_key'];
public function identity() {
return $this->morphMany(Identity::class, 'identifiable');
}
@rizqidjamaluddin
rizqidjamaluddin / User.php
Created Oct 26, 2015
Base set of classes for more complex features - NOT a "pattern" to be followed like you will be cursed for not adhering to, if you use an unnecessary factory I will hunt you down with a super soaker
View User.php
<?php
/**
* @property int $id
* @property string $email
* @property string $password
* @property Carbon $created_at
*/
class User extends Model {
View TreeRenderer.php
<?php
// the renderers - uses
class TreeRenderer {
public function render (File $file) {
// we'll use string concats, but you could also use a node tree and transform to XML
$result = "";
if ($file instanceof Folder) {
View UserTransformer.php
<?php
class UserTransformer {
public function transform(User $user) {
// transformers are handy for...
return [
'name' => $user->name, // just showing data
'age' => $user->age . ' years', // appending a word at the end
'avatar' => url('/avatars/'.$user->avatar), // formulating a URL
@rizqidjamaluddin
rizqidjamaluddin / SomeDistantApiGateway.php
Created May 13, 2015
Laravel API gateway classes with a service provider and config file
View SomeDistantApiGateway.php
<?php
class SomeDistantApiGateway {
public function __construct($apiKey) {
$this->apiKey = $apiKey;
}
public function getSomeData() {
// whatever API request over guzzle or something
You can’t perform that action at this time.