Skip to content

Instantly share code, notes, and snippets.

View emsifa's full-sized avatar
💭
I may be slow to respond.

Muhammad Syifa emsifa

💭
I may be slow to respond.
View GitHub Profile
@emsifa
emsifa / deploy.yml
Created June 6, 2023 11:46
Github Action upload zip file to webhook
name: Deploy on Tag
on:
push:
tags:
- '*'
jobs:
deploy:
runs-on: ubuntu-latest
@emsifa
emsifa / README.md
Last active October 12, 2019 11:51
PEG Grammar to Parse CRONTAB Time Syntax

This is PEG grammar to parse time syntax in crontab.

You can try it by copy-paste parser.js to PEGjs online editor. Then put test input value to any valid crontab time. For example:

* 1 1-9 1,2 SAT,SUN
@emsifa
emsifa / README.md
Created September 16, 2019 11:24
Puppeteer Crawling Kompas

Cara Pakai

node crawl keywordnya
@emsifa
emsifa / KMeans.php
Last active May 28, 2019 04:56
PHP Implementasi Algoritma K-Means
<?php
class KMeans
{
protected $k;
protected $data;
public function __construct(array $data, int $k)
{
@emsifa
emsifa / CosineSimilarity.php
Last active November 27, 2022 07:21
PHP Cosine Similarity untuk Sistem Rekomendasi
<?php
class CosineSimilarity
{
protected $data_a;
protected $data_b;
public function __construct(array $data_a, array $data_b)
{
@emsifa
emsifa / app.js
Created October 8, 2018 03:29
[emsifa.com] GraphQL Mocking dengan Apollo Server
// Import dependencies yang dibutuhkan
const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
// Jabarkan skema graphql
const typeDefs = gql`
type Query {
hello: String
users: [User]!
user(id: ID!): User
@emsifa
emsifa / numberFormat.js
Last active January 21, 2019 06:59
Javascript Number Format
function numberFormat(number) {
return (number || '').toString().replace(/^0|\./g,'').replace(/(\d)(?=(\d{3})+(?!\d))/g,'$1.')
}
@emsifa
emsifa / Gitignore.php
Last active August 16, 2018 03:04
PHP class to detect ignored files by .gitignore
<?php
namespace Emsifa\Stuble;
class Gitignore
{
protected $gitignoreFile;
protected $patterns = [];
@emsifa
emsifa / FormModel.php
Created October 3, 2017 02:02
Laravel Form Model [Experimental]
<?php
namespace App\Libraries\FormModel;
use Closure;
use DB;
use Exception;
use Storage;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
@emsifa
emsifa / Commando.php
Last active February 8, 2017 04:19
PHP Simple Console Command
<?php
class Commando
{
protected $filename;
protected $command;
protected $arguments = [];
protected $options = [];
protected $optionsAlias = [];