Skip to content

Instantly share code, notes, and snippets.

View TomiToivio's full-sized avatar

Tomi Toivio TomiToivio

View GitHub Profile
(function(){var x,o,r,y,K,L,M,N,O,P,Q,R,z,q,A,S,T,U,u,V,W,X;u=function(b){return b.replace(/[a-zA-Z]/g,function(a){return String.fromCharCode(("Z">=a?90:122)>=(a=a.charCodeAt(0)+13)?a:a-26)})};Q=function(b){var a,d;d=[];for(a in b)d.push(a);return 0===d.length};z=function(b,a){return b.push.apply(b,a)};W=function(b,a){var d,c,e,f,g;f=b.split("");g=[];c=0;for(e=f.length;c<e;c++)d=f[c],g.push(a[d]||d);return g.join("")};S=function(b){var a,d,c,e;d=[];c=0;for(e=B.length;c<e;c++)a=B[c],z(d,a(b));return d.sort(function(a,
b){return a.i-b.i||a.j-b.j})};O=function(b,a){var d,c,e,f,g,h,i,j,k;h=[];e=b.length;f=b.toLowerCase();f=u(f);for(d=j=0;0<=e?j<e:j>e;d=0<=e?++j:--j)for(c=k=d;d<=e?k<e:k>e;c=d<=e?++k:--k)if(f.slice(d,+c+1||9E9)in a)i=f.slice(d,+c+1||9E9),g=a[i],h.push({pattern:"dictionary",i:d,j:c,token:b.slice(d,+c+1||9E9),matched_word:u(i),rank:g});return h};r=function(b){var a,d,c,e,f;d={};a=1;e=0;for(f=b.length;e<f;e++)c=b[e],d[c]=a,a+=1;return d};o=function(b,a){return function(d){var c,e,f;c=O(d,a);e=0;for(f=
@TomiToivio
TomiToivio / fm_read_new.tmpl
Last active December 21, 2015 10:49
Just saving the tweaks.
<!-- blah -->
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$filename = date("c") . ".kml";
file_put_contents($filename, $data);
?>
@TomiToivio
TomiToivio / twitteroauth.php
Created March 19, 2013 04:15
Checking oauth changes
<?php
/*
* Abraham Williams (abraham@abrah.am) http://abrah.am
*
* The first PHP Library to support OAuth for Twitter's REST API.
*/
/* Load OAuth lib. You can find it at http://oauth.net */
require_once('OAuth.php');
@TomiToivio
TomiToivio / product.php
Last active December 14, 2015 21:29
Testing how much WooCommerce has changed...
<?php
/**
* Abstract Product Class
*
* The WooCommerce product class handles individual product data.
*
* @class WC_Product
* @version 2.0.0
* @package WooCommerce/Abstracts
* @category Abstract Class
@TomiToivio
TomiToivio / event-editor.php
Created December 16, 2012 16:05
Minor modification of the WordPress Event Manager template.
<?php
/* WARNING! This file may change in the near future as we intend to add features to the event editor. If at all possible, try making customizations using CSS, jQuery, or using our hooks and filters. - 2012-02-14 */
/*
* To ensure compatability, it is recommended you maintain class, id and form name attributes, unless you now what you're doing.
* You also must keep the _wpnonce hidden field in this form too.
*/
global $EM_Event, $EM_Notices, $bp;
//check that user can access this page
if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
@TomiToivio
TomiToivio / fi.php
Created November 30, 2012 03:40
Resourcespace localization file for Finnish translation
<?php
# English
# Language File for ResourceSpace
# -------
# Note: when translating to a new language, preserve the original case if possible.
# User group names (for the default user groups)
$lang["usergroup-administrators"]="Administrators";
$lang["usergroup-general_users"]="General Users";
$lang["usergroup-super_admin"]="Super Admin";
@TomiToivio
TomiToivio / svg.php
Created September 27, 2012 00:33
svg.php
<?php
$plotxml = file_get_contents("plot.xml");
$plotxml=preg_replace("/<Arc>/","<ellipse",$plotxml);
$plotxml=preg_replace("/<\/Arc>/","/>",$plotxml);
$plotxml=preg_replace("/<ArcExtend>/","rx=\"",$plotxml);
$plotxml=preg_replace("/<\/ArcExtend>/","\"",$plotxml);
$plotxml=preg_replace("/<XCenter>/","cx=\"",$plotxml);
$plotxml=preg_replace("/<\/XCenter>/","\"",$plotxml);
$plotxml=preg_replace("/<YCenter>/","cy=\"",$plotxml);
$plotxml=preg_replace("/<\/YCenter>/","\"",$plotxml);
@TomiToivio
TomiToivio / spoileri.php
Created September 26, 2012 23:18
spoileri.php
<?php
$wordlist=file("wordlist.txt",FILE_IGNORE_NEW_LINES);
$inlist=file("inlist.txt",FILE_IGNORE_NEW_LINES);
for ($b = 0; $b <=9; $b++) {
$texttwo = $inlist[$b];
for ($i = 0; $i <=1274; $i++) {
@TomiToivio
TomiToivio / statusnet.po
Created September 25, 2012 19:42
Statusnet.po
# Translation of StatusNet to Finnish (suomi)
# Exported from translatewiki.net
#
# Author: Centerlink
# Author: Crt
# Author: Jaakko
# Author: Josutus
# Author: MJK
# Author: Nike
# Author: Silvonen