Skip to content

Instantly share code, notes, and snippets.

View aquilax's full-sized avatar
💭
Fighting entropy

Evgeniy Vasilev aquilax

💭
Fighting entropy
View GitHub Profile
@aquilax
aquilax / gist:1103910
Created July 25, 2011 11:02
NodeList in GO
package main
import (
"fmt"
"strconv"
)
type Elements map[string]float32
type Node struct {
@aquilax
aquilax / gist:1175621
Created August 27, 2011 17:11
NoviGeroi2 Fight
public function fight() {
$cmd = $this->getCommandHero();
if ($cmd) {
// Da real deal
switch ($cmd) {
case 'hit' : $this->heroHit(); break;
case 'spell' : $this->heroSpell(); break;
case 'run' : if ($this->heroRun()) return $this->messages; break;
default: // Cheating hurts
}
@aquilax
aquilax / gen.php
Created September 28, 2011 12:07
Генератор на жълти заглавия
<?php
$w1 = array(
'мистерията',
'тайната',
);
$where = array(
'от университета в Тянхъй',
'в малкото немско село',
@aquilax
aquilax / gist:1329929
Created November 1, 2011 04:21
New Google Reader minimizer
#top-bar, #gb{
display: none;
}
#lhn-add-subscription-section, #viewer-header {
height: 40px;
}
a.entry-source-title {
color: #12C;
@aquilax
aquilax / gist:1333830
Created November 2, 2011 14:55
Naive Bayes classifier in PostgreSQL
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.1.1
-- Dumped by pg_dump version 9.1.1
-- Started on 2011-11-02 16:53:36 EET
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
@aquilax
aquilax / MY_Output.php
Created November 4, 2011 08:40
CodeIgniter static website generator
<?php
/**
* Creates static version of CodeIgniter site
*
* @author aquilax
*/
class MY_Output extends CI_Output {
function __construct() {
@aquilax
aquilax / news.php
Created November 18, 2011 11:26
application/classes/model/news.php
<?php
/**
* Description of news
*
* @author aquilax
*/
class Model_News extends Model{
/*
* Load the news for the first page
@aquilax
aquilax / redica.php
Created December 18, 2011 09:34
row
<?php
$string = 'tabdaderdty';
$counter = array_fill(0, 255, 0);
for ($i = 0; $i < strlen($string); $i++) {
$counter[ord($string[$i])]++;
}
arsort($counter);
echo $string.PHP_EOL;
foreach($counter as $k => $v){
if ($v == 0) {
@aquilax
aquilax / redica.php
Created December 19, 2011 13:22
Геометрична прогресия
<?php
$K = 4;
function set($K){
$prev = 0;
for ($i = 0; $i < $K; $i++){
$prev = $prev * 2 + 1;
}
return $prev;
}
@aquilax
aquilax / slovom.php
Created December 19, 2011 19:03
Slovom from scratch
<?php
function edinici($n) {
switch($n) {
case 1: return 'едно';
case 2: return 'две';
case 3: return 'три';
case 4: return 'четири';
case 5: return 'пет';
case 6: return 'шест';