Skip to content

Instantly share code, notes, and snippets.

View fachryansyah's full-sized avatar
🌑
code in the darkness

Muhammad Fahriansyah fachryansyah

🌑
code in the darkness
  • Depok City, Indonesia
View GitHub Profile
@fachryansyah
fachryansyah / PlaceController.php
Created September 24, 2018 09:53
Place Controller
<?php
namespace App\Http\Controllers;
use App\Place;
use App\Schedule;
use Illuminate\Http\Request;
class ScheduleController extends Controller
{
===============================================================================================================
0. Buat fungsi sederhana untuk menghitung jumlah huruf hidup dan huruf mati dari suatu kalimat. Contoh:
input: "omama" hasil: "huruf mati: 2, huruf hidup: 2" (huruf hidup yaitu o dan a. a tidak perlu muncul 2x)
1. Buat fungsi sederhana untuk mengurutkan abjad dari suatu kalimat, dengan memisahkan huruf hidup dan huruf mati. Contoh:
input: "omama" hasil: "aaomm" ('a', dan 'o' sebagai huruf hidup dan 'm' sebagai huruf mati)
input: "osama" hasil: "aaoms"
2. Buat webservice untuk salah satu fungsi di atas (boleh pilih nomor 0 atau nomor 1)
@fachryansyah
fachryansyah / PasswordPattern.js
Created November 18, 2019 05:33
Sample solution for password pattern
const pattern = [
[2, 4, 5],
[1, 3, 4, 5, 6],
[2, 4, 5, 6],
[1, 2, 5, 7, 8],
[1, 2, 3, 4, 6, 7, 8, 9],
[2, 3, 5, 8, 9],
[4, 5, 8],
[4, 5, 6, 7, 9],
[5, 6, 8]
DIR=deployments/docker
RECIPE=${DIR}/docker-compose.yaml
NAMESPACE=builder${COMPONENT}
MIGRATION_PATH=`pwd`/migrations/test
include .env
export $(shell sed 's/=.*//' .env)
DIND_PREFIX ?= $(HOME)
/*
HOW TO USE
zipFile( FOLDER-WANT-TO-ZIP, TARGET-DIRECTORY )
PACKAGE : archive/zip
*/
func zipFile(source, target string) error {
zipfile, err := os.Create(target)
if err != nil {
return err
const command = (cmd, text, position) => {
let index = position - 1;
let countL = 0;
let countB = 0;
cmd.map(item => {
if(item === "l"){
countL += 1
func TestFileUpload(t *testing.T) {
url := fmt.Sprintf("http://localhost%s/api/file-upload", HTTP_PORT_TEST)
var fileSize int = 1024
sampleFile, err := createFileWithFormat(fileSize, ".jpeg")
if err != nil {
t.Fatal(err)
}
defer os.Remove(sampleFile)
import { createAppContainer } from 'react-navigation'
import { createStackNavigator } from 'react-navigation-stack'
import { createSharedElementStackNavigator } from 'react-navigation-shared-element'
import HomeScreen from './Screens/HomeScreen'
import DetailScreen from './Screens/DetailScreen'
const sharedStackNavigator = createSharedElementStackNavigator(
createStackNavigator,
{
import React, { Component } from 'react'
import {
View,
Text,
Image,
TouchableOpacity,
FlatList,
Dimensions,
StyleSheet
} from 'react-native'