View ngnix.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process nginx with pidfile /var/run/nginx.pid | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" |
View promise.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example to convert base64 string to image | |
import 'dart:async'; // for Completer() | |
import 'dart:convert'; // for base64Decode() | |
import 'dart:ui' as ui; // for Image & decodeImageFromList() | |
Future<ui.Image> getImageFromString(String imageString) { | |
var imageBytes = base64Decode(imageString); | |
final Completer<ui.Image> completer = Completer(); | |
ui.decodeImageFromList(imageBytes, (image) => completer.complete(image)); |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
View formatPhoneNumber.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var COUNTRY_CODE = "+62"; | |
function formatPhoneNumber(phone) { | |
var formatted = ""; | |
if (phone.substring(0, 3) !== COUNTRY_CODE) { | |
if (phone.substring(0, 2) === COUNTRY_CODE.substr(1)) { | |
formatted = COUNTRY_CODE + phone.slice(2); | |
} else if (phone.substring(0, 1) === "0") { | |
formatted = COUNTRY_CODE + phone.slice(1); | |
} else { |
View OnChangeInputSearch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var typingDelay = 500; // miliseconds | |
var timer = null; | |
function showSpinner(){ | |
// ... | |
} | |
function hideSpinner(){ | |
// ... | |
} | |
function doAjax(value){ | |
// ... |