Skip to content

Instantly share code, notes, and snippets.

View trustmaster's full-sized avatar

Vladimir Sibirov trustmaster

View GitHub Profile
@trustmaster
trustmaster / view.php
Created March 25, 2012 11:59
CotView class interface proto, first take
<?php
defined('COT_CODE') or die('Wrong URL.');
(function_exists('version_compare') && version_compare(PHP_VERSION, '5.3.0', '>=')) or die('PHP version 5.3 or higher is required.');
require_once cot_incfile('forms');
require_once cot_incfile('orm');
/**
@trustmaster
trustmaster / space_detector.php
Created June 18, 2012 08:54
Trailing/leading spaces detector for PHP files
<ul>
<?php
/**
* Finds all PHP files containing trailing or leading spaces
* before or after PHP open/close tags.
*/
foreach (rglob('**/*.php') as $file)
{
if (preg_match('`\A\s+<\?`m', file_get_contents($file)))
@trustmaster
trustmaster / basecompl_plain.go
Created August 11, 2013 09:28
BaseComplementer in plain Go
package main
import (
"bufio"
"fmt"
"log"
"os"
"runtime"
)
@trustmaster
trustmaster / chanperf_test.go
Created August 16, 2013 16:30
Simple benchmark for Go channel performance on different data types
package chanperf
import (
"testing"
)
func BenchmarkInt(b *testing.B) {
fin := make(chan bool)
comm := make(chan int)
go func() {
@trustmaster
trustmaster / gist:7247940
Created October 31, 2013 11:07
Odnoklassniki HybridAuth setStatus example
$hybrid = new HybridAuth();
// Odnoklassniki bypass friend selection and just post status
try
{
$fullname = "{$hybrid->profile->firstName} {$hybrid->profile->lastName}";
$hybrid->adapter->setUserStatus($L['quest_wall_message'] . $fullname. ', ' . "http://example.com/quest?guess={$usr['id']}");
}
catch (Exception $e) { /* Handle errors here */ }
@trustmaster
trustmaster / Odnoklassniki.php
Created October 31, 2013 11:09
Modified Odnoklassniki adapter for HybridAuth with setUserStatus() method support.
<?php
/*!
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
/**
* Hybrid_Providers_Odnoklassniki provider adapter based on OAuth2 protocol
*
@trustmaster
trustmaster / Solarized-Light.ksf
Created February 19, 2014 17:41
Improved Solarized Light color scheme for Komodo Edit
Version = 11
Booleans = {'caretLineVisible': True, 'preferFixed': 1, 'useSelFore': True}
CommonStyles = {'attribute name': {'fore': 7872391},
'attribute value': {'fore': 3100463},
'bracebad': {'bold': True, 'fore': 3093212},
'bracehighlight': {'fore': 3093212},
'classes': {'fore': 35253},
'comments': {'fore': 7695960, 'italic': True},
@trustmaster
trustmaster / Description.md
Created July 28, 2014 08:15
Router component interface example

Component description

Router is a static HTTP router mapping indexed HTTP patterns to indexed request outputs.

Inports

patterns inport is an addressable parameter accepting patterns the router handles, e.g.:

'get /hello' -&gt; PATTERN[0] Router
@trustmaster
trustmaster / CreateImage-node.coffee
Created November 18, 2014 14:58
Patched CreateImage for node
noflo = require 'noflo'
Canvas = require 'canvas'
Image = Canvas.Image
urlUtil = require 'url'
request = require 'request'
temporary = require 'temporary'
fs = require 'fs'
# @runtime noflo-nodejs
# @name CreateImage
@trustmaster
trustmaster / Test.js
Created February 18, 2015 17:43
NoFlo issue #273 example
var noflo = require("noflo");
exports.getComponent = function() {
var component = new noflo.Component;
component.description = "Test";
component.inPorts.add('in', {
datatype: 'all',
addressable: true
});