Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
ISO SP BBT 2020

devflow devflow

🍻
ISO SP BBT 2020
View GitHub Profile
View lotta.js
const moment = require("moment");
const crypto = require('crypto')
const RAW_DATA = [{"d":"2020.04.11","v":[2,5,14,28,31,32,20]},{"d":"2020.04.12","v":[2,5,14,28,31,32,20]}]
const DEFAULT_DATE_FORMAT = "YYYY.MM.DD"
const DEFAULT_REPEAT = 100
function calcPowerpack(start, end) {
let start_date = moment(start, DEFAULT_DATE_FORMAT).startOf('day'),
@devflow
devflow / tsn.rs
Last active Jan 18, 2020
369game (three six nine game) with RUST!
View tsn.rs
//three six nine. 369 game
fn main() {
for n in 1..100 {
let mut cur_num: u32 = n;
let mut clap_cnt: u32 = 0;
while cur_num > 0 {
let cur_x:u32 = cur_num % 10;
clap_cnt += match cur_x {
@devflow
devflow / here.php
Created Jun 17, 2016
php. get max or min in array except zero(or something)
View here.php
<?php
$myArray = array(1,0,2,3,0,4,5,99,6,7,8,9,0);
$except = array(0);
$value = min(array_values(array_diff($myArray, $except)));
// $value == 1
@devflow
devflow / example.java
Created Jun 8, 2016
android-async-http file array.
View example.java
Map<String, ArrayList<File>> fileMaps = new HashMap<>();
for (QueryParam queryParam : queryParams) {
if(queryParam == null) continue;
String type = queryParam.type;
if (type.equalsIgnoreCase("string")) {
requestParams.add(queryParam.key, queryParam.val);
} else if (type.equalsIgnoreCase("file")) {
try {
if(!fileMaps.containsKey(queryParam.key)){
View XE, center crop for createImageFile()
function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop')
{
// check params
if (($source_file = FileHandler::exists($source_file)) === FALSE)
{
return;
}
$target_file = FileHandler::getRealPath($target_file);
if(!$resize_width)
@devflow
devflow / IndexedFragmentPagerAdapter.java
Created Nov 27, 2015
IndexedFragmentPagerAdapter.java
View IndexedFragmentPagerAdapter.java
public class IndexedFragmentPagerAdapter extends FragmentPagerAdapter {
public SparseArray<Fragment> fragments = new SparseArray<>();
public IndexedFragmentPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return null;