Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View agungsb's full-sized avatar

Agung Surya Bangsa agungsb

View GitHub Profile
@agungsb
agungsb / ribbon_shape.dart
Created September 10, 2018 14:07
Flutter's Ribbon Shape
import 'package:flutter/material.dart';
class RibbonShape extends StatefulWidget {
@override
RibbonShapeState createState() => RibbonShapeState();
}
class RibbonShapeState extends State<RibbonShape> {
@override
Widget build(BuildContext context) {
@agungsb
agungsb / razzle.config.js
Created August 7, 2018 03:55
Razzle config with support for SASS for after.js
"use strict";
const autoprefixer = require("autoprefixer");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
modify: (baseConfig, { dev }) => {
const appConfig = Object.assign({}, baseConfig);
// Setup SCSS
@agungsb
agungsb / fancy_fab_step_2.dart
Created May 31, 2018 03:02
Create A Simple Animated FloatingActionButton in Flutter
import 'package:flutter/material.dart';
class FancyFab extends StatefulWidget {
final Function() onPressed;
final String tooltip;
final IconData icon;
FancyFab({this.onPressed, this.tooltip, this.icon});
@override
@agungsb
agungsb / fancy_fab_step_1.dart
Last active May 31, 2018 02:59
Create A Simple Animated FloatingActionButton in Flutter
import 'package:flutter/material.dart';
class FancyFab extends StatefulWidget {
@override
_FancyFabState createState() => _FancyFabState();
}
class _FancyFabState extends State<FancyFab>
with SingleTickerProviderStateMixin {
bool isOpened = false;
@agungsb
agungsb / fancy_fab.dart
Last active October 27, 2020 10:38
Create A Simple Animated FloatingActionButton in Flutter
import 'package:flutter/material.dart';
class FancyFab extends StatefulWidget {
final Function() onPressed;
final String tooltip;
final IconData icon;
FancyFab({this.onPressed, this.tooltip, this.icon});
@override
@agungsb
agungsb / hexToRgb.js
Created December 11, 2017 13:43
Function to convert color code from Hex To RGB
function hexToRgb(hex) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
return r + r + g + g + b + b;
});
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
const divisor = 1000;
const pi = 1/divisor;
class Faded extends React.PureComponent {
constructor(props) {
super(props);
let i;
let collection = [];