Skip to content

Instantly share code, notes, and snippets.

View zo0m's full-sized avatar

Igor Kalashnikov zo0m

  • Full Stack Developer
  • Odessa
View GitHub Profile
@zo0m
zo0m / sqlite.collation.search.coffee
Created January 26, 2016 11:24
SQLITE Collation workaround for search
searchString = "hello z World!"
joinWordsToSearch = (words)->words.join(".{0,5}")
getModifiedWords = (words, modificator)->
modifiedWords = words.slice()
modifiedWords[i] = modificator(word) for word, i in modifiedWords
modifiedWords
@zo0m
zo0m / list.coffee
Last active February 12, 2016 02:25
TableView scroll event offset on Android , Appcelerator Titanium
# NOT FINISHED
# It works, but not good, for such transformation waiting hyperloop
topOffset = 30
previousOffset = 0
previousFirstVisibleItem = 0
previousOffsetY = 30
previousMoveDirection = "down"
upCounter = 0
@zo0m
zo0m / list.coffee
Created February 13, 2016 09:50
TableView scroll handling on Android , Appcelerator Titanium
previousMoveDirection = "down"
previousItem = 0
upCounter = 0
downCounter = 0
$.eventList.addEventListener "scroll", (event) ->
moveDirection = "down"
currentItem = parseInt event.firstVisibleItem
if currentItem is previousItem
@zo0m
zo0m / flatObject.coffee
Created March 16, 2016 14:20
Make object flatt paramObject.subParamObject.subSubSubParam - paramObject_subParamObject_subSubSubParam
convertFlatObject = (objectToFlat)->
flatObject = {}
convertValue = (flatObject, key, value)->
if value isnt null and value isnt undefined
if typeof value is "string" or typeof value is "number"
flatObject[key] = value
else if typeof value is "object"
flatSubObject = convertFlatObject value
@zo0m
zo0m / gdox.js
Last active March 19, 2016 17:34
Google docs search
var statusColumnOffset = 0;
var range = SpreadsheetApp.getActiveSheet().getDataRange();
function setRowColors() {
for (var i = 0; i < range.getLastRow(); i++) {
findFrodOfIP(i);
}
}
function findFrodOfIP(ipIndex) {
@zo0m
zo0m / index.js
Created April 26, 2016 11:40 — forked from afranioce/index.js
Appcelerator swipe card like tinder
var win = Titanium.UI.createWindow({
backgroundColor: "#ffffff",
title: "win"
});
// animations
var animateLeft = Ti.UI.createAnimation({
left: -520,
transform: Ti.UI.create2DMatrix({rotate: 60}),
opacity: 0,
moment = require "moment"
crypto = require "crypto"
TelegramBot = require('node-telegram-bot-api')
token = require("./config").token
Place = require "../models/place"
EventType = require "../models/event-type"
Event = require "../models/event"
@zo0m
zo0m / app.tss
Created December 1, 2016 13:03
FontAwesome Appcelerator Titanium support
".fa" : {
font : {
fontFamily: Alloy.Globals.FONT_AWESOME_FONT_FAMILY,
fontSize : 12
}
}
".fa-10" : {
font : {
fontFamily: Alloy.Globals.FONT_AWESOME_FONT_FAMILY,
@zo0m
zo0m / getNormalizedWordsArray.es6
Last active December 20, 2016 10:09
String ===> Words array
/*
getNormalizedWordsArray("Hello, my name is Igor. What are you doing?:)")
>>> ["Hello", ",", " ", "my", " ", "name", " ", "is", " ", "Igor", ".", " ", "What", " ", "are", " ", "you", " ", "doing", "?:)"]
*/
function getNormalizedWordsArray(phrase) {
const punctuationRegEx = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g;
const spaceRegEx = /\s+/g;
const digitRegEx = /\d/g;
const wordRegEx = /\w/g;
@zo0m
zo0m / uploadFileOnChangeAngularSnippet.jade
Created December 24, 2016 08:32
uploadFileOnChangeAngularSnippet.jade
input#fileToUpload(type='file', onchange='angular.element(this).scope().uploadFile(this.files[0])')