Skip to content

Instantly share code, notes, and snippets.

View gilankpam's full-sized avatar
🏸
Focusing

Gilang gilankpam

🏸
Focusing
View GitHub Profile
@gilankpam
gilankpam / test
Created August 14, 2013 14:05
test
def test():
print "Cuman test"
@gilankpam
gilankpam / BookLibraryApplication.java
Last active August 29, 2015 14:11
Qiscus Code Challenge
/*
README
------
Below there's a class called BookLibraryApplication with only one method: main.
Your mission, should you choose to accept it, is to add codes _only_ in the sections labeled "PLACE YOUR CODE HERE"
in order to:
@gilankpam
gilankpam / composer.json
Last active March 4, 2017 00:06
Docker Compose for PHP Development Environment
{
"name": "Awesome Project",
"authors": [
{
"name": "Gilang Pambudi",
"email": "gilankpam@example.com"
}
],
"require": {
"slim/slim": "^3.0"
@gilankpam
gilankpam / Dockerfile
Created March 4, 2017 00:06
Docker Compose php
FROM php:alpine
# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=/bin --filename=composer && \
php -r "unlink('composer-setup.php');"
RUN mkdir /app
# Copy semua source code ke directory /app dalam docker container
@gilankpam
gilankpam / docker-compose.yml
Last active March 4, 2017 00:14
Docker Compose php
version: '2'
services:
web:
# build image dari Dockerfile dalam directory yang sama
build: .
ports:
# {host}:{docker}
- 9090:8080
volumes:
# mount semua source code project ke directory /app pada docker container
<?php
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->get('/hello', function($request, $response) {
$response->getBody()->write("Hello, $name");
return $response;
@gilankpam
gilankpam / multimedia.ahk
Created April 16, 2017 10:53
AutoHotKey for multimedia shortcut
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^f9::Send {Media_Prev}
^f10::Send {Media_Next}
^f11::Send {Volume_Down}
^f12::Send {Volume_Up}
@gilankpam
gilankpam / redux-request-success-failure.js
Last active May 17, 2022 14:04
redux-request-success-failure.js
function reduxHelper (actionName, fn) {
if (typeof actionName !== 'string') {
throw new Error('actionName must be a string')
}
if (typeof fn !== 'function') {
throw new Error('fn must be a function')
}
const actionNameUpper = actionName.toUpperCase()
const actionRequest = actionNameUpper + '_REQUEST'
const actionSuccess = actionNameUpper + '_SUCCESS'
const initialState = {
loading: false,
user: null,
error: null
}
export default function (state = initialState, action) {
switch(action.type) {
case 'LOGIN_REQUEST':
return {
function login(username, password) {
return dispatch => {
dispatch({
type: 'LOGIN_REQUEST'
})
api.login(username, password)
.then(user => dispatch({
type: 'LOGIN_SUCCESS',
user
}))