Smart stores for Riot (like flux, based on ideas from RiotControl)
Small (<1.5Kb) flux-like store container.
Make sure loot.js is included in your page after riot.js:
#!/bin/bash | |
######## | |
# Purpose :- To take a backup of MongoDB Collections and upload to AWS s3 | |
# Requirement :- Make Sure Collection.config file is present in /data/Backup/mongodb | |
# format for Collection.config is db|collection | |
# For example | |
# db1|collections1 |
<?php | |
// PHP PThreads issue 329 diagnostic script by John Wellesz | |
// Also a nice example of shared object management... | |
const ONEMUSEC = 1000000; | |
printf('file age: %d', time() - filemtime(__file__)); | |
echo PHP_EOL; |
CREATE TYPE address AS (country text, city text, zip varchar(6), street text, number text, building text); | |
CREATE TABLE users (id SERIAL PRIMARY KEY, email text, adresses address[]); | |
INSERT INTO users(email, adresses) VALUES('[email protected]', ARRAY[ROW('RU', 'Moscow', '123123', 'Lenina', '5', 'a')::address, ROW('RU', 'SPB', '123456', 'Gagarina', '102', '5')::address]); | |
SELECT * FROM users; |
<?php | |
function resizeImage($source, $dest, $new_width, $new_height, $quality) | |
{ | |
// Taken from http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html | |
$image = new Phalcon\Image\Adapter\GD($source); | |
$source_height = $image->getHeight(); | |
$source_width = $image->getWidth(); | |
$source_aspect_ratio = $source_width / $source_height; | |
$desired_aspect_ratio = $new_width / $new_height; | |
if ($source_aspect_ratio > $desired_aspect_ratio) { |