Skip to content

Instantly share code, notes, and snippets.

View tadeubas's full-sized avatar

Tads tadeubas

View GitHub Profile
@bitsnaps
bitsnaps / ZipUnzip.groovy
Last active September 4, 2021 16:15
Zip and UnZip files using Groovy
import java.util.zip.*
String zipFileName = "file.zip"
String inputDir = "logs"
def outputDir = "zip"
//Zip files
ZipOutputStream zipFile = new ZipOutputStream(new FileOutputStream(zipFileName))
new File(inputDir).eachFile() { file ->
@PrimaryFeather
PrimaryFeather / ColorOffsetStyle.as
Last active February 16, 2018 08:18
A MeshStyle for Starling 2 that allows to add an offset to each color channel of a mesh, as described in the Starling manual.
// =================================================================================================
//
// Starling Framework
// Copyright Gamua GmbH. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
@PrimaryFeather
PrimaryFeather / ColorOffsetFilter.as
Last active April 6, 2017 01:26
The revised ColorOffsetFilter of the tutorial from the Starling manual; now with fixed PMA handling.
// =================================================================================================
//
// Starling Framework
// Copyright Gamua GmbH. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================
@PrimaryFeather
PrimaryFeather / cloneObject
Last active June 11, 2018 11:18
Utility method to clone an AS3 object of any type.
package com.gamua.flox.utils
{
import flash.utils.describeType;
import flash.utils.getQualifiedClassName;
/** Creates a deep copy of the object.
* Beware: all complex data types will become mere 'Object' instances. Supported are only
* primitive data types, arrays and objects. Any properties marked with "NonSerialized"
* meta data will be ignored by this method.
*
@PrimaryFeather
PrimaryFeather / gist:5983685
Last active February 29, 2020 09:35
Water distortion filter, implemented with Starling's "DisplacementMapFilter".
private function addDistortionTo(target:DisplayObject):void
{
var offset:Number = 0;
var scale:Number = Starling.contentScaleFactor;
var width:int = target.width;
var height:int = target.height;
var perlinData:BitmapData = new BitmapData(width * scale, height * scale, false);
perlinData.perlinNoise(200*scale, 20*scale, 2, 5, true, true, 0, true);