Skip to content

Instantly share code, notes, and snippets.

View antonybudianto's full-sized avatar
💪
Build up!

Antony Budianto antonybudianto

💪
Build up!
View GitHub Profile
var leaveTypes = ['Cuti tahunan', 'Cuti sakit', 'Remote', 'Cuti tidak berbayar', 'Maternity Leave']
$('#see-more-list').append('<input style="border:1px solid gray; margin:10px" id="slksearch" type="text" placeholder="Search by name" />')
$('#see-more-list').append('<select id="slktype"><option>All</option>'+ leaveTypes.map(l => '<option>'+l+'</option>').join('')+'</select>')
$('#see-more-list').append('<span style="margin: 5px" id="slktotal"></span>')
$("#slksearch").on('input', () => {
var val = $('#slksearch').val()
handleOnChange(val, $('#slktype').val())
})
@johngrimes
johngrimes / nginx.conf
Created February 14, 2018 22:23
Ideal Nginx configuration for JavaScript single-page app
server {
listen 80;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_comp_level 9;
etag on;
location / {
try_files $uri $uri/ /index.html;
}
server {
location ~* (serviceworker\.js)$ {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
proxy_no_cache 1;
}
}
@brandonroberts
brandonroberts / async-ng-module-loader.ts
Last active April 26, 2019 12:40
Webpack Async NgModule Loader
import {Injectable, NgModuleFactory, NgModuleFactoryLoader, Compiler, Type} from '@angular/core';
class LoaderCallback {
constructor(public callback) {}
}
export let load: Type = (callback: Function) => {
return new LoaderCallback(callback);
};
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@gaearon
gaearon / reducers.js
Last active December 11, 2020 14:56
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});
@mksoni88
mksoni88 / overridelog.js
Created September 15, 2015 04:10
Override console.log to print line number ( and filename ) (sometimes helpful in nodejs debugging)
_log = console.log;
global.console.log = function() {
var traceobj = new Error("").stack.split("\n")[2].split(":");
var file = traceobj[0].split(process.env.PWD + '/')[1];
var line = traceobj[1];
var new_args = [file + ":" + line + " >>"];
new_args.push.apply(new_args, arguments);
_log.apply(null, new_args);
};
@mul14
mul14 / README.md
Last active February 10, 2023 00:55
Simple Laravel Search Trait

Usage

Put SearchTrait.php in app directory. Then use SearchTrait in your model, like so

use App\SearchTrait;
use Illuminate\Database\Eloquent\Model;

class Article extends Model 
{
@DarrenN
DarrenN / get-npm-package-version
Last active April 17, 2024 16:57 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION