Skip to content

Instantly share code, notes, and snippets.

View dyazincahya's full-sized avatar
🔥
plus ultra

Kang Cahya dyazincahya

🔥
plus ultra
View GitHub Profile
var enumsModule = require("ui/enums");
var cameraModule = require("camera");
var fs = require('file-system');
var bghttp = require("nativescript-background-http");
exports.takephoto = function(args) {
cameraModule.takePicture({width: 800, height: 800, keepAspectRatio: true}).then(function(picture) {
var savepath = fs.knownFolders.currentApp().path + "/saved_images";
var filename = 'img_' + new Date().getTime() + '.jpg';
var filepath = fs.path.join(savepath, filename);
@dyazincahya
dyazincahya / install_phpexcel_php7.sh
Created October 22, 2018 09:09 — forked from belgattitude/install_phpexcel_php7.sh
Install libxl, php_excel extension on PHP7.1 (ondrej/ppa)
#!/bin/bash
#
# ilia/php_excel extension example install script for PHP7+
#
# usage:
# > sudo ./install_phpexcel_php7.sh
# > (optionally) sudo service php7.1-fpm restart)
#
# requirements:
# - Ubuntu 64bits (trusty/xenial)
#!/bin/bash
#
# Example script to install LibXL, ilia/php_excel on PHP 7.2 (ondrej/ppa)
#
# Usage:
# > sudo ./install_phpexcel_php72.sh
# > sudo service php7.2-fpm reload (if using fpm)
#
# Requirements:
# - Tested with Ubuntu 64bits (14.04, 16.04+)
@dyazincahya
dyazincahya / ffmpeg.md
Last active February 11, 2019 11:17 — forked from alexellis/timelapse.md
Create timelapse and add watermark with ffmpeg

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

my ex : ffmpeg -r 24 -pattern_type glob -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution
@dyazincahya
dyazincahya / gist:ca5e4a9d2c55a60ca5a96caf42c4a33b
Created April 4, 2019 03:25 — forked from tonyspiro/gist:490962be30a67af923de
Curl Get, Post, Put and Delete in PHP
<?php
class Curl {
public function get($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@dyazincahya
dyazincahya / spinner_with_icons
Created April 2, 2020 08:50 — forked from a-v-ebrahimi/spinner_with_icons
Android Spinner with icons
final Item[] items = {
new Item("Email", android.R.drawable.ic_menu_add),
new Item("Facebook", android.R.drawable.ic_menu_delete),
new Item("...", 0),//no icon for this one
};
ListAdapter adapter = new ArrayAdapter<Item>(
this,
android.R.layout.select_dialog_item,
android.R.id.text1,
@dyazincahya
dyazincahya / README.md
Created April 3, 2020 16:49 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@dyazincahya
dyazincahya / EmailValidator.kt
Created July 28, 2020 07:38 — forked from ironic-name/EmailValidator.kt
Kotlin regex email validator function
fun isEmailValid(email: String): Boolean {
return Pattern.compile(
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]|[\\w-]{2,}))@"
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9]))|"
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$"
).matcher(email).matches()
}
@dyazincahya
dyazincahya / bench_excel_writers.py
Created August 19, 2020 04:11 — forked from jmcnamara/bench_excel_writers.py
Benchmark of several Python Excel writing modules
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
#
import sys
from time import clock