Skip to content

Instantly share code, notes, and snippets.

View whitershade's full-sized avatar

Oleksandr Prokopenko whitershade

View GitHub Profile
@whitershade
whitershade / flex justife-content space-between without flex
Last active May 27, 2016 16:47
flex justife-content space-between without flex
ul {
font: 14px Verdana, Geneva, sans-serif;
text-align: justify;
/* Обнуляем для родителя*/
line-height: 0;
font-size: 1px;
/* 1px для Opera */
/* Лекарство для IE6-7*/
text-justify: newspaper;
zoom: 1;
*** create a new repository on the command line ***
echo "# my-brackets-template" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/whitershade/my-brackets-template.git
git push -u origin master
*** push an existing repository from the command line ***
git remote add origin https://github.com/whitershade/my-brackets-template.git
@whitershade
whitershade / React
Last active March 6, 2018 10:17
React
npm init
npm install webpack -g
npm install --save react react-dom react-router
npm install --save-dev babel-core babel-loader babel-preset-es2015 babel-preset-react
mkdir public
mkdir app
cd app
mkdir components
touch index.html
JS
let mainHeader = document.getElementById('main-header');
setMainHeaderHeight();
window.onresize = function () {
setMainHeaderHeight();
}
function setMainHeaderHeight() {
let height;
if (typeof document.height !== 'undefined') {
height = document.height // For webkit browsers
@whitershade
whitershade / gist:0ad945e00ad0d5ee2fb9d398db769cfe
Last active February 15, 2017 09:16
js speed test from code school
/*
* var BPtest = new SpeedTest( noBP,listsForTests );
* BPtest.startTest();
*/
var SpeedTest = function(testImplement,testParams,repetitions){
this.testImplement = testImplement;
this.testParams = testParams;
this.repetitions = repetitions || 10000;
this.average = 0;
let user = {
name: "sam", totalReplies: 17, isBlocked: false
};
user[Symbol.iterator] = function(){
let properties = Object.keys(this);
let count = 0;
let isDone = false;
Google Chrome
Для установки Google Chrome нужно загрузить ключ репозитория:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c "echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google.list"
sudo apt-get update
sudo apt-get install google-chrome-stable
Atom
sudo add-apt-repository ppa:webupd8team/atom
Треугольник в цикле
for (let i = ''; i.length < 8; i += '#')
console.log(i);
FizzBuzz
for (let i = 1; i <= 100; i += 1) {
switch (true) {
case i % 3 === 0 && i % 5 === 0:
const array = [2, 4, 6, 10, 7, 3, 5];
const qsort = array => {
if (array.length < 2) return array;
const pivot = array[Math.round(array.length / 2)];
const less = array.filter(i => i < pivot);
const greater = array.filter(i => i > pivot);
// 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