Skip to content

Instantly share code, notes, and snippets.

View winarcooo's full-sized avatar
🏠
Working from Mars

Andy Winarko winarcooo

🏠
Working from Mars
View GitHub Profile
@winarcooo
winarcooo / FrogJump.py
Created July 13, 2020 11:03
[FrogJump] Count minimal number of jumps from position X to Y #hackerrank #codility #python
"""
Task description
A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D.
Count the minimal number of jumps that the small frog must perform to reach its target.
Write a function:
def solution(X, Y, D)
@winarcooo
winarcooo / photo_api.yaml
Last active July 14, 2020 01:21
[swagger udemy assignment 2] #udemy #online-courses
# every open API needs this
swagger: '2.0'
# document metadata
info:
version: "0.3.0"
title: Music API
# URL data
host: api.muzicplayz.com
@winarcooo
winarcooo / balance_brackets.py
Created July 12, 2020 10:27
[balance brackets] #hackerrank #python
#!/bin/python3
import math
import os
import random
import re
import sys
def isPair(open, close):
if open == "(" and close == ")":
@winarcooo
winarcooo / .leptonrc
Last active July 12, 2020 10:02
[Lepton configurations] snippet manager #lepton #config
{
"theme": "dark",
"autoUpdate": false,
"snippet": {
"expanded": true,
"newSnippetPrivate": false,
"sorting": "updated_at",
"sortingReverse": true
},
"editor" : {
{
"workbench.startupEditor": "newUntitledFile",
"window.zoomLevel": 0,
"editor.fontSize": 15,
"workbench.colorTheme": "Solarized Dark",
"workbench.iconTheme": "Monokai Pro (Filter Octagon) Icons",
"files.autoSave": "afterDelay",
"todo-tree.tree.showScanModeButton": false,
"editor.minimap.enabled": false,
"explorer.confirmDragAndDrop": false,
@winarcooo
winarcooo / love.py
Last active July 12, 2020 10:32
[contain love] #hackerrank #python
# Enter your code here. Read input from STDIN. Print output to STDOUT
import sys
def solution(baseWord, words):
counter = 0
for word in words.split():
if set(baseWord).issubset(set(word)):
counter += 1
return counter
@winarcooo
winarcooo / docker-compose.yml
Created May 21, 2019 04:21 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
function Person(saying) {
this.saying = saying
}
Person.prototype.talk = function() {
console.log('I say:', this.saying);
}
// replicate what `new` does
function spawn(constructor) {
function changeValue(arr) {
return function fromIndex(arrIndex) {
return function withValue(newValue) {
return arr.map(function(arr, index){
if (index == arrIndex) {
return newValue
}
return arr
})
}
/**
* prototype is just way of saying for this object use other object
* as a backup/delegate/prototype
* if someone call my object with a property that doesn't exist on my object
* go lookin this other object
*/
function talk() {
console.log(this.sound)
}