Skip to content

Instantly share code, notes, and snippets.

View jamalsa's full-sized avatar

Jamal Saepul Aziz jamalsa

  • Bandung, Indonesia
View GitHub Profile
@anthonytxie
anthonytxie / hodl20.py
Created March 24, 2018 21:01
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{
public class NamedParamStatement {
public NamedParamStatement(Connection conn, String statementWithNames) throws SQLException {
Pattern findParametersPattern = Pattern.compile("(?<!')(:[\\w]*)(?!')");
Matcher matcher = findParametersPattern.matcher(statementWithNames);
while (matcher.find()) {
fields.add(matcher.group().substring(1));
}
prepStmt = conn.prepareStatement(statementWithNames.replaceAll(findParametersPattern.pattern(), "?"));
}
@Noitidart
Noitidart / Beamoff Tool.iso
Last active October 20, 2022 12:21
Shows how to install OSX 10.10.1 onto Oracle VirtualBox on AMD
@deepak1556
deepak1556 / dom.js
Last active June 6, 2017 02:31
virtual-dom with dom-delegator
var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var Delegator = require('./dom-delegator')
var state = {
clicks: function (ev) {
delegator.unlistenTo('click')
console.log(ev)
@skyfishjy
skyfishjy / CursorRecyclerViewAdapter.java
Last active December 16, 2023 08:55
CursorRecyclerViewAdapter
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@akuzemchak
akuzemchak / l4project.sh
Last active November 16, 2023 08:48
New L4 project with clean history
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@ayosec
ayosec / 0README.md
Last active February 10, 2017 00:52
Spray: example with a router based on actors

Test with

$ sbt run

And then,

$ curl localhost:8080/mars/hi

$ curl localhost:8080/jupiter/hi

@comp615
comp615 / leaflet_numbered_markers.css
Created April 2, 2012 23:51
Numbered Markers in Leaflet (JS Mapping)
.leaflet-div-icon {
background: transparent;
border: none;
}
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;
<?php
// LIMONADE FLASH FEATURES EXAMPLES
require_once 'lib/limonade.php';
function configure()
{
option('env', ENV_DEVELOPMENT);
}
function before()