Skip to content

Instantly share code, notes, and snippets.

View aratak's full-sized avatar
💾
Uncaught TypeError: [object Object] is not a function

Alexey Osipenko aratak

💾
Uncaught TypeError: [object Object] is not a function
View GitHub Profile
@aratak
aratak / .gitignore
Last active September 5, 2015 02:44
full .gitignore
pkg
.bundle
.DS_Store
TAGS
REVISION
*.tmproj
*~
.settings
.project
.tasks-cache
@aratak
aratak / USER.sh
Last active September 5, 2015 10:34
sql script for rails db on production
sudo su
groupadd www
useradd aratak --shell /bin/bash --group www --home /home/aratak
mkdir /home/aratak
chown aratak:www /home/aratak
passwd aratak
# add username to AllowUsers /etc/ssh/sshd_config
# add `aratak ALL=(ALL) NOPASSWD:ALL` to the /etc/sudoers
sudo service ssh restart
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:1433316
Created December 5, 2011 11:35
MySQL - install and remove
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
sudo rm /etc/my.cnf
sudo vi /etc/hostconfig and delete string MYSQLCOM=-YES-
Download from http://dev.mysql.com/downloads/mysql/5.1.html#downloads
@aratak
aratak / .gitignore
Created January 4, 2012 15:28
.gigignore for NodeJS
TAGS
REVISION
*.tmproj
*~
.DS_Store
.settings
.project
.tasks-cache
.svn
*DONOTVERSION*
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dmitriy-kiriyenko
dmitriy-kiriyenko / Gemfile
Created October 5, 2012 07:56
Solve of cross-domain ajax requests
# Add it to Gemfile
gem 'rack-cors', :require => 'rack/cors'
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:8779865
Created February 3, 2014 07:08
Mars rovers description

PROBLEM : MARS ROVERS

A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This plateau, which is curiously rectangular, must be navigated by the rovers so that their on-board cameras can get a complete view of the surrounding terrain to send back to Earth.

A rover's position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An example position might be 0, 0, N, which means the rover is in the bottom left corner and facing North.

In order to control a rover, NASA sends a simple string of letters. The possible letters are 'L', 'R' and 'M'. 'L' and 'R' makes the rover spin 90 degrees left or right respectively, without moving from its current spot. 'M' means move forward one grid point, and maintain the same heading.

Assume that the square directly North from (x, y) is (x, y+1).

INPUT:

@aratak
aratak / encryptor.rb
Created June 19, 2015 10:02
encryptor.rb
require 'bcrypt'
module Encryptor
def digest(password)
::BCrypt::Password.create(password, cost: 3).to_s
end
module_function :digest
def compare(encrypted_password, password)
return false if encrypted_password.blank?
@aratak
aratak / git-deploy.md
Created September 7, 2015 06:15
How to deploy Ruby on Rails application.

Step 1. Creating Our Repository

Login to your VPS from command line and type the following:

$ cd /var
$ mkdir repo && cd repo
$ mkdir site.git && cd site.git
$ git init --bare

--bare means that our folder will have no source files, just the version control.

find . -name '*.*' ! -type d -exec bash -c 'expand -t 2 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;