Skip to content

Instantly share code, notes, and snippets.

@swvitaliy
swvitaliy / list.txt
Created July 27, 2013 18:23
link list on mind maps for phrase verbs
Other authors
Get - http://www.xmind.net/m/qdeB/
Turn - http://www.xmind.net/m/qdeB/
My
Come - http://www.xmind.net/m/qY4z/ (взято отсюда http://www.youtube.com/watch?v=rgr-OLtUq4c, на сайте автора карты не нашел)
(следующие как минимум 3 слова взяты отсюда - http://lingualeo.ru/glossary/85)
Get - http://www.xmind.net/m/PnRX/
Go - http://www.xmind.net/m/iqhM/
Look - http://www.xmind.net/m/aF5y/
@swvitaliy
swvitaliy / btree.js
Last active December 20, 2015 07:58
var gid = (function (i) {
return function () {
return i++;
}
})(0);
function searchPos(arr, key) {
for (var i = 0; i < arr.length; i++) {
if (arr[i]>key) return i;
}
# level #6
class Player
def initialize
@level_state = 's0'
@battle_state = 'berserk'
@enemy_score = 0
# how much enemies need kill without rest and backward walk
@need_kill = 0
@prev_health = 20
end
@swvitaliy
swvitaliy / eventBroker.js
Last active December 20, 2015 20:49
js event broker
_slice = Array.prototype.slice;
function eventBroker() {
var evHandlers = {};
var evQueue = {};
return {
unhandled: function() {
return evQueue;
},
on: function(event, handler, queuePop) {
library(plyr)
rating <- read.csv("a.csv")
dates <- rating$"дата.и.время"
dates <- as.POSIXct(dates, format="%H:%M:%S %d.%m.%Y")
rating$hours <- as.numeric(gsub("^\\d{4}-\\d{2}-\\d{2}\\s(\\d{2}):\\d{2}:\\d{2}", "\\1", dates))
data <- ddply(rating, 'hours', function(x) c(count=nrow(x), mean=mean(x$"оценка.пользователя")))
data$mean <- rowMeans(subset(data, select = c(count, mean)), na.rm = TRUE)
plot(data$hours, data$mean,
type="S",
<?php
class FatalException extends Exception {}
interface DesignFolderIf {
public function getBasePath();
public function getFiles();
}
function cssProp(toS) {
return function(obj) {
obj.toString = toS;
return obj;
};
}
var enumProp = function(fields) {
return cssProp(function() {
var self = this;
@swvitaliy
swvitaliy / bucket.php
Created August 21, 2013 15:20
generation a bucket table
$lnk = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die ('Not connected: ' . mysql_error());
mysql_select_db(DB_NAME, $lnk) or die ('Can\'t use foo: ' . mysql_error());
mysql_query("SET NAMES 'cp1251'", $lnk);
create_bucket_table($_SERVER['argv'][1], $lnk);
function Q($sql, $lnk) {
select in_type('tinyint', 100, 1);
+----------------------------+
| in_type('tinyint', 100, 1) |
+----------------------------+
| 1 |
+----------------------------+
1 row in set (0.11 sec)
mysql> select in_type('tinyint', 300, 1);
+----------------------------+
<?php
function emoji($text) {
static $t = '{"😄":"1","😃":"3","😀":"847","😊":"2","☺":"4","😉":"5","😍":"6","😘":"7","😚":"8","😗":"850","😙":"851","😜":"12","😝":"13","😛":"852","😳":"9","😁":"11","😔":"17","😌":"10","😒":"14","😞":"18","😣":"23","😢":"24","😂":"26","😭":"25","😪":"31","😥":"20","😰":"21","😅":"777","😓":"16","😩":"785","😫":"786","😨":"22","😱":"28","😠":"29","😡":"30","😤":"784","😖":"19","😆":"778","😋":"781","😷":"32","😎":"782","😴":"859","😵":"787","😲":"27","😟":"853","😦":"854","😧":"855","😈":"780","👿":"33","😮":"857","😬":"856","😐":"783","😕":"849","😯":"858","😶":"788","😇":"779","😏":"15","😑":"848","👲":"96","👳":"97","👮":"99","👷":"98","💂":"102","👶":"92","👦":"88","👧":"89","👨":"91","👩":"90","👴":"94","👵":"93","👱":"95","👼":"100","👸":"101","😺":"791","😸":"789","😻":"792","😽":"795","😼":"794","🙀":"798","😿":"797","😹":"790","😾":"796","👹":"650","👺":"651","🙈":"799","🙉":"800","🙊":"801","💀":"103","👽":"34","💩":"55","🔥":"54","✨":"44","🌟":"45","💫":"659","💥":"657","💢":"46","💦":"51","💧":"658","💤":"49","💨":"50","👂":"107","👀":"108","👃":"109","👅":"637