Skip to content

Instantly share code, notes, and snippets.

@ejabu
ejabu / settings.json
Created January 25, 2020 15:07
LATEST CONFIG JSON
{
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": [
"--max-line-length",
"120",
],
"python.testing.nosetestArgs": [
"ms2"
],
WITH tdf_truncate AS (
-- truncate datetime yang sampai miliseconds
SELECT
date_trunc('second', critical_time) AS crt,
date_trunc('second', datetime_stock) AS dts,
id_spbu,
id_product,
shift
FROM
opt.t_demand_forecast137
@ejabu
ejabu / search.sql
Created September 23, 2019 03:20
Get similiar column name through Schemas and Tables (PSQL)
select t.table_schema,
t.table_name,
c.column_name
from information_schema.tables t
inner join information_schema.columns c on c.table_name = t.table_name
and c.table_schema = t.table_schema
where c.column_name ilike '%shift%'
and t.table_schema not in ('information_schema', 'pg_catalog')
and t.table_type = 'BASE TABLE'
order by t.table_schema;
@ejabu
ejabu / command.sh
Created September 17, 2019 14:46
Count of Code Lines
git ls-files | xargs wc -l
git ls-files | grep '\.py' | xargs wc -l
@ejabu
ejabu / python
Created September 9, 2019 02:17
Python Docs
class Station:
"""
This class is a struct for Station
"""
def __init__(self,
schedules: 'list of Schedules',
colour: str):
self.schedules = schedules
self.colour = colour
@ejabu
ejabu / main.dart
Created August 28, 2019 22:31
Add new element to class
class LessonCategory {
final String name;
LessonCategory(this.name);
@override
String toString() {
return 'LessonCategory{name: $name}';
}
}
@ejabu
ejabu / main.dart
Created August 19, 2019 09:57
Flutter Complex Sorting of a List
class Item {
int personId;
Item({this.personId});
String toString() {
return "$personId";
}
}
List<Item> list = [
@ejabu
ejabu / main.dart
Created August 16, 2019 17:09
Buttom Sheet avoid Keyboard
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Buttom Sheet avoid Keyboard',
@ejabu
ejabu / settings.json
Last active August 14, 2019 23:53
Vscode Setting Aug 19
{
"liveServer.settings.port": 5600,
"workbench.settings.useSplitJSON": false,
"workbench.tree.indent": 24,
"files.exclude": {
"**/.idea": true,
"**/__pycache__": true,
"**/*.pyc": true,
"**/.git": true,
"**/*.lock": true,
@ejabu
ejabu / learn_factory.dart
Created June 19, 2019 02:04
Factory in Fautter
// Ref : https://theburningmonk.com/2013/09/dart-implementing-the-singleton-pattern-with-factory-constructors/
class CommonClass {
CommonClass() {
print("Init : CommonClass");
}
String namaDev;
String get getNamaDev {