Skip to content

Instantly share code, notes, and snippets.


Ferri Sutanto ghprod

  • Purwokerto, Indonesia
View GitHub Profile
ghprod /
Last active Mar 17, 2021
Auto Restart PHP5-FPM When Down or Bad Gateway
if curl --head -sf -o /dev/null; then
echo "PHP FPM is up"
service php5-fpm restart && service nginx restart && service mysql restart
echo "Opps .. service was down" | mail -s "PHP-FPM Service Down"
ghprod /
Last active Mar 4, 2021
Mirror Website Using Httrack Command Line
mkdir ~/Mirror

cd ~/Mirror

httrack --connection-per-second=8 --sockets=8 --keep-alive --display --verbose --advanced-progressinfo --disable-security-limits -i -s0 -m -F 'Mozilla/5.0 (X11;U; Linux i686; en-GB; rv:1.9.1) Gecko/20090624 Ubuntu/9.04 (jaunty) Firefox/3.5' -#L999999
ghprod / background-image.ts
Created May 24, 2016
Background Image Style Directive for Angular 2 and Ionic 2
View background-image.ts
import {Directive, ElementRef, Input} from '@angular/core';
selector: '[background-image]'
export class BackgroundImage {
private el: HTMLElement;
constructor(el: ElementRef) {
this.el = el.nativeElement;
ghprod / fade_on_scroll.dart
Created Jul 29, 2020 — forked from smkhalsa/fade_on_scroll.dart
A Widget that automatically fades its child based on scroll position
View fade_on_scroll.dart
import 'package:flutter/material.dart';
class FadeOnScroll extends StatefulWidget {
final ScrollController scrollController;
final double zeroOpacityOffset;
final double fullOpacityOffset;
final Widget child;
{Key key,
ghprod / app.js
Created Mar 15, 2014
Cordova Exit App Confirm
View app.js
document.addEventListener("deviceready", deviceisready, false);
function deviceisready(){
alert("Device Ready is called");
document.addEventListener("backbutton", function(e){
if ( $('.ui-page-active').attr('id') == 'mainpage') {
//window.location = "#exitDialog";
ghprod / bmi.dart
Created Sep 25, 2020 — forked from roipeker/bmi.dart
BMI Calculator clone with GetX (+ Theme modes)
View bmi.dart
import 'dart:async';
import 'dart:math' as math;
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:get/get.dart';
ghprod / helpers.php
Created Jun 12, 2014
Delete Laravel Cache By Pattern
View helpers.php
foreach (Cache::getMemory() as $cacheKey => $cacheValue)
if (strpos($cacheKey, 'mypackage') !== false)
ghprod /
Created Aug 3, 2020 — forked from CodingDoug/
Patterns for security with Firebase Authentication: offload work to Cloud Functions

This is the runnable sample code from the blog post [Patterns for security with Firebase Authentication: offload work to Cloud Functions][1]. It discusses offloading work from a client app to Cloud Functions using an authentication trigger.

  1. Create a new Firebase project
  2. Enable email/password authentication
  3. Provision Cloud Firestore and apply the rules given in this gist
  4. Use the Firebase CLI to create a workspace for Functions using TypeScript
  5. Deploy the given HTML and JavaScript to Firebase Hosting (the CLI emulator will also work).
  6. Deploy the function code to Cloud Functions using the Firebase CLI
ghprod / main.dart
Last active Jul 31, 2020
GetX Debug Template
View main.dart
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() => runApp(App());
class App extends StatelessWidget {
Widget build(BuildContext context) {
return GetMaterialApp(
initialRoute: '/',
ghprod / main.dart
Created Jun 28, 2020 — forked from PetreaLoredana/main.dart
This code generates a screen with a custom bidirectional and infinite scrollable PageView in Flutter. Replace your own assets names. More details can be found on Medium.
View main.dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(CustomPageViewApp());
class CustomPageViewApp extends StatelessWidget {
Widget build(BuildContext context) {