Skip to content

Instantly share code, notes, and snippets.

@ftvs
ftvs / expansion_tile_sample.dart
Created Feb 27, 2020
Flutter ExpansionTile sample. Can be used as an alternative to ExpansionPanelList to build expansion panel lists, scrollable and expandable dropdown lists.
View expansion_tile_sample.dart
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
class ExpansionTileSample extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@ftvs
ftvs / main.dart
Last active Mar 5, 2020
Multiple futures with different return types executing in parallel without Future.wait. https://dartpad.dev/ff8617ecf0f40ea26c028c26531bc719
View main.dart
void main() {
futureTest();
}
futureTest() async {
final watch = Stopwatch()..start();
print("elapsed: ${watch.elapsedMilliseconds}");
final futureInt = Future.delayed(Duration(seconds: 2), () => 1);
final futureString = Future<String>.delayed(Duration(seconds: 2), () => "laterz");
@ftvs
ftvs / stepper.dart
Created Feb 3, 2020 — forked from slightfoot/stepper.dart
Flutter Stepper Example
View stepper.dart
import 'package:flutter/material.dart';
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _currentStep = 0;
@ftvs
ftvs / ffxvdmgcalc.js
Created Sep 15, 2018
Final Fantasy XV damage calculator for jscalc.io
View ffxvdmgcalc.js
'use strict';
function calc(inputs)
{
var output = {};
var str = inputs.str;
var pwr = inputs.pwr;
var lvl = inputs.lvl;
var vit = inputs.vit;
/*
@ftvs
ftvs / PhonecallReceiver.java
Last active Oct 25, 2020
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
View PhonecallReceiver.java
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@ftvs
ftvs / iOS_time_zones.txt
Created Jul 30, 2015
List of time zones on iOS. Displays 30 July 2015 12AM GMT+0 in various time zones.
View iOS_time_zones.txt
July 30, 2015 at 12:00:00 AM GMT Africa/Abidjan
July 30, 2015 at 12:00:00 AM GMT Africa/Accra
July 30, 2015 at 3:00:00 AM GMT+3 Africa/Addis_Ababa
July 30, 2015 at 1:00:00 AM GMT+1 Africa/Algiers
July 30, 2015 at 3:00:00 AM GMT+3 Africa/Asmara
July 30, 2015 at 12:00:00 AM GMT Africa/Bamako
July 30, 2015 at 1:00:00 AM GMT+1 Africa/Bangui
July 30, 2015 at 12:00:00 AM GMT Africa/Banjul
July 30, 2015 at 12:00:00 AM GMT Africa/Bissau
July 30, 2015 at 2:00:00 AM GMT+2 Africa/Blantyre
@ftvs
ftvs / main.py
Created Nov 16, 2014
Project Euler
View main.py
import os, sys
if __name__ == '__main__':
print("Python Version: " + sys.version)
print("Python Executable: " + sys.executable)
print("Env var TEST_NAME: " + os.getenv('TEST_NAME', None))
def primes(maxprime):
primes = [2]
@ftvs
ftvs / README.md
Last active Oct 21, 2016
Project README.md template.
View README.md

Project Information

(this section can omit information that is already on the project page, in which case a link will suffice)

  • OS:
  • Devices:
  • Orientation:
  • Framework: (eg iOS UIKit framework, cocos2d-x, Unity)
  • Multiple resolution policy (how the app handles multiple screen resolutions, sizes and aspect ratios)

Setup

View GUIUtils.cs
using UnityEngine;
using System.Collections;
using Holoville.HOTween;
public class GUIUtils : MonoBehaviour
{
public UISprite transition;
void Awake()
{
@ftvs
ftvs / CameraShake.cs
Last active Oct 29, 2020
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
View CameraShake.cs
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
You can’t perform that action at this time.