Skip to content

Instantly share code, notes, and snippets.

View denstepa's full-sized avatar
👨‍💻
focusing

Denis Stepanov denstepa

👨‍💻
focusing
View GitHub Profile

This is a quick guide on installing HTTPie for Mac OS X systems. This is also useful if you want the python package management utility pip. An installed copy of Homebrew is a prerequisite.

HTTPie

# install the python package provided with homebrew
brew install python

# install HTTPie with the pip utility
pip install httpie
# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core libssl-dev libsqlite3-dev curl nodejs nginx
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
# Add rbenv to the path:
echo 'export RBENV_ROOT=~/.rbenv' >> ~/.bash_profile
/*
* Flatten Object @gdibble: Inspired by https://gist.github.com/penguinboy/762197
* input: { 'a':{ 'b':{ 'b2':2 }, 'c':{ 'c2':2, 'c3':3 } } }
* output: { 'a.b.b2':2, 'a.c.c2':2, 'a.c.c3':3 }
*/
var flattenObject = function(ob) {
var toReturn = {};
var flatObject;
for (var i in ob) {
if (!ob.hasOwnProperty(i)) {
@denstepa
denstepa / deploy.rb
Last active August 29, 2015 14:26 — forked from andrey-skat/deploy.rb
Local assets precompilation on Rails 4 using Capistrano 3
# also you need to uncomment next line in Capfile
# require 'capistrano/rails/assets'
namespace :deploy do
namespace :assets do
Rake::Task['deploy:assets:precompile'].clear_actions
desc 'Precompile assets locally and upload to servers'
task :precompile do
@denstepa
denstepa / nginx.conf
Last active August 29, 2015 14:27 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@denstepa
denstepa / email_dots_validator.rb
Created September 14, 2015 11:49
rails - stop dots abuseing in emails
def no_dots_email_abuse
if User.where("(regexp_replace(users.email, '\\.', '', 'gi') LIKE ?)", email.gsub('.', '')).any?
errors.add(:email, 'is already taken. Please try another email.')
end
end
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
1) О культуре написания кода очень хорошо здесь - http://www.amazon.com/The-Readable-Code-Theory-Practice/dp/0596802293
Есть море аналогов (которые я все перечитал), к примеру:
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
http://www.ozon.ru/context/detail/id/4187085/
Но "art of redable code" показался мне самым интересным изданием, как в плане содеражтельности, так и в плане оформления :)
2) Очень важно прочесть Фаулера и особенно его http://martinfowler.com/books/eaa.html
Если интересно, то про рефакторинг - http://martinfowler.com/books/refactoring.html, я честно скажу, там все идеи очень простые, поэтому бежать можно буквально по верхушкам и особо не вникать, потому что он там часто простые идеи описывает 5-ую страница текста.
<script type="text/javascript">
//<![CDATA[
var _flocktory = window._flocktory = _flocktory || [];
_flocktory.push({
'order_id': '10778083-0001',
'email': 'testmail@flocktory.com',
'name': 'denis ',
'price': '1400',
'items': [{
'id': '1',
git config remote.origin.push HEAD