Skip to content

Instantly share code, notes, and snippets.

@fenixkim
fenixkim / MailgunEmailService.php
Created July 24, 2016 16:27
Kirby Custom Mailgun Email Service
<?php
// Put this file in the Plugins folder
email::$services['mailgun'] = function($email) {
if(empty($email->options['key'])) throw new Error('Missing Mailgun API key');
if(empty($email->options['domain'])) throw new Error('Missing Mailgun API domain');
$url = 'https://api.mailgun.net/v3/' . $email->options['domain'] . '/messages';
@fenixkim
fenixkim / config.php
Last active March 31, 2017 18:06
RederTime Class for Kirby CMS based on the dMOTION version (https://github.com/dmotion/kirby-rendertime)
<?
/*
----------
Rendertime
----------
This pluging is disabled by default, use this in your config.php file of your
develoment enviroment and set the 'rendertime' property to true as follow
@fenixkim
fenixkim / clean-kirbytext.php
Last active January 3, 2016 03:39
Same than `kirbytext()` but only allows the tags in `allowedTags`
<?php
/**
* Same than `kirbytext()` but only allows the tags in `allowedTags`
*
* <code>
*
* $text = 'This is a html text with a **strong** and *em* text';
*
* // Remove all tags except strong tags
@fenixkim
fenixkim / KirbyQuery
Last active December 20, 2015 08:38
Kirby toolkit db::query to parse binary string to hexadecimal automatically using the bin2hex PHP function
<?php
/**
* Runs a MySQL query.
* You can use any valid MySQL query here.
* This is also the fallback method if you
* can't use one of the provided shortcut methods
* from this class.
*
* @param string $sql The sql query
@fenixkim
fenixkim / enlace.as
Created May 8, 2013 20:24
El siguiente código muestra como abrir una URL al presionar un botón.
import flash.events.MouseEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;
boton1.addEventListener(MouseEvent.CLICK, onBoton1Click);
boton2.addEventListener(MouseEvent.CLICK, onBoton2Click);
function onBoton1Click (event:MouseEvent) {
navigateToURL(new URLRequest("http://apple.com"), "_blank");
}
@fenixkim
fenixkim / VideoPlayer.as
Created April 23, 2013 02:24
Crea un reproductor de video muy simple.
import com.goto.media.*;
import flash.events.MouseEvent;
// Crea una instacia de ChromelessVideoPlayer
// Crea un reproductor de video sin piel
var player:ChromelessVideoPlayer = new ChromelessVideoPlayer();
// Lo agrega al scenario
addChild(player);
// Se pone el tamaño inicial
player.setSize(480, 320);
@fenixkim
fenixkim / AutomatorShorten.sh
Created April 19, 2013 00:20
This is an Automator's URL Shortening service, this gets the selected URL from any application and shorten it using the bittly.com API. You must create a new service workflow from automator and paste the code in a **Run shell script** action of automator. Don't forget update the LOGIN and APY_KEY This is useful to shorten the urls from Dropbox a…
# Gets the input
URL="$(cat)";
# Encode the url using php
URL=$(php -r "echo urlencode('$URL');")
# Shorts the url using bitly api and copy to clipboard
curl -s "http://api.bitly.com/v3/shorten?login=LOGIN&apiKey=APY_KEY&longUrl=$URL&format=txt" | pbcopy
# Plays a sound when finishe
@fenixkim
fenixkim / Gallery.as
Created April 18, 2013 14:34
Este es un complemento del ejemplo de Reel.as. pero se agrega un contenedor de imagen para mostrar la imagen grande. Cuando se hace click sobre una vista previa, el recurso de la imagen de la misma, se carga en el contenedor de la imagen grande.
@fenixkim
fenixkim / AccordioMenu.as
Last active December 16, 2015 08:59
El siguiente código crea un menú de acordeón de 2 niveles. Para que el código siguiente funcione usted debe tener los elementos de la bibliotecas exportados para Action Script. Se recomienda crear un clip de película y pegar el código en el primer fotograba Aquí hay un ejemplo funcional en Flash: http://j.mp/XU7NS5 (Requiere CS5+)
import com.goto.display.layout.VLayout;
import flash.display.MovieClip;
import com.goto.display.View;
import com.greensock.TweenMax;
import com.greensock.easing.*;
////////////////////////////////////
// Variables
////////////////////////////////////
@fenixkim
fenixkim / ImageLoader.as
Created April 17, 2013 14:23
El siguiente ejemplo demuestra como cargar una imagen externa
// Dependencias
// http://code.goto.com.co
// http://tweenmax.com
import com.goto.display.ImageView;
import flash.events.Event;
var ic:ImageView = new ImageView();
//ic.showMask = true;
ic.source = "http://fc08.deviantart.net/fs71/f/2013/106/9/8/i_am_so_confused_by_woxys-d61y6ri.jpg";