Skip to content

Instantly share code, notes, and snippets.

View rubinchyk's full-sized avatar
🇮🇱

Alexey Rubinchyk rubinchyk

🇮🇱
View GitHub Profile
@rubinchyk
rubinchyk / Untitled-1
Created February 6, 2017 10:35
Javascript: console.log alternative for objects
var output = '';
for (var property in response) {
output += property + ': ' + response[property]+'; ';
}
console.log('Response: ', output);
@rubinchyk
rubinchyk / isEmpty.js
Last active August 27, 2017 09:07
[is Array or Object empty?] JavaScript: is Array or Object empty? #JavaScript
// Speed up calls to hasOwnProperty
var hasOwnProperty = Object.prototype.hasOwnProperty;
function isEmpty(obj) {
// null and undefined are "empty"
if (obj == null) return true;
// Assume if it has a length property with a non-zero value
// that that property is correct.
@rubinchyk
rubinchyk / Untitled-1
Last active September 28, 2024 20:48
[Create random string with specific symbols(numbers) and length] Create random string with specific symbols(numbers) and length #JavaScript
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
return result;
}
var rString = randomString(32, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
<application android:allowBackup="false" android:fullBackupContent="false"
@rubinchyk
rubinchyk / Untitled-1
Created May 3, 2017 08:01
Ionic1: LocalStorage not being cleared on app uninstall
//LocalStorage not being cleared on app uninstall - Android 6
//AndroidManifest.xml
<application android:allowBackup="false" android:fullBackupContent="false" ...
@rubinchyk
rubinchyk / socketCheatsheet.js
Last active September 28, 2024 20:48
[Socket.io Cheatsheet] Socket.io Cheatsheet #socket_io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@rubinchyk
rubinchyk / tmux.md
Last active December 1, 2017 08:32
[tmux Cheatsheet] Cheatsheet for tmux terminal window #tmux

tmux-cheat-sheet

Create new tmux session and saving every time

  • tmux attach -t base || tmux new -s base

Ctrl + b - Open command mode

Ctrl+b+d - Exit without closing session (detach session)

tmux a -t nameOfSession - Open tmux with need session

Config

@rubinchyk
rubinchyk / snippet.js
Created July 17, 2017 07:01
[Identify OSx throw JS with adding specifyc class into body] #JavaScript #css #osx
if(navigator.platform.match('Mac') !== null) {
document.body.setAttribute('class', 'OSX');
}
@rubinchyk
rubinchyk / translit.sh
Created July 21, 2017 20:53
Linux transliterate recursively files and folders from cyrillic
# Даем права на запуск:
# chmod +x translit.sh
# Открываем и копируем листинг скрипта:
@rubinchyk
rubinchyk / counter.html
Last active September 28, 2024 20:46
[Counters using css] Counter implementation using regular css #css
<!DOCTYPE html>
<html>
<head>
<style>
body {
counter-reset: section;
}
h2::before {
counter-increment: section;