Skip to content

Instantly share code, notes, and snippets.

View rizqidjamaluddin's full-sized avatar

Rizqi Djamaluddin rizqidjamaluddin

  • Jakarta, Indonesia
View GitHub Profile
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 {
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
<?php
$file = fopen("src.txt", 'r');
$out = fopen("result.csv", 'w');
fputcsv($out, ['first_name', 'last_name', 'address', 'city', 'state', 'zip']);
$buffer = [];
$counter = 0;

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
<?php
// this is another kind of user.
class Admin extends Model {
protected $fillable = ['public_key'];
public function identity() {
return $this->morphMany(Identity::class, 'identifiable');
}
SOME_API_KEY=12345
@rizqidjamaluddin
rizqidjamaluddin / User.php
Created October 26, 2015 03:49
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
<?php
/**
* @property int $id
* @property string $email
* @property string $password
* @property Carbon $created_at
*/
class User extends Model {
<?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) {
@rizqidjamaluddin
rizqidjamaluddin / UserTransformer.php
Last active August 29, 2015 14:27
Transformer Example
<?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 12:02
Laravel API gateway classes with a service provider and config file
<?php
class SomeDistantApiGateway {
public function __construct($apiKey) {
$this->apiKey = $apiKey;
}
public function getSomeData() {
// whatever API request over guzzle or something