Skip to content

Instantly share code, notes, and snippets.

@longkey1
longkey1 / function_proccess_deleted.sql
Last active October 3, 2015 02:28
The function for making it move to a deleted table.
CREATE OR REPLACE FUNCTION process_deleted() RETURNS TRIGGER AS $$
BEGIN
IF (TG_OP = 'DELETE') THEN
EXECUTE 'INSERT INTO deleted_' || TG_RELNAME || ' VALUES(($1).*)' USING OLD;
RETURN OLD;
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
@longkey1
longkey1 / parss_rss.php
Created April 5, 2012 04:03
Parse rss or atom feeds
<?php
function parseRss($feedUrl) {
$result = array();
// "@" is for error handling
$feed = @simplexml_load_file($feedUrl);
//atom
if (isset($feed->entry)) {
$result['title'] = (string)$feed->title;
$result['link'] = (string)$feed->link->attributes()->href;