Skip to content

Instantly share code, notes, and snippets.

@AlexVKO
AlexVKO / http-service.ts
Created July 31, 2017 19:05
interceptor
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/finally';
import Rx from 'rxjs/Rx';
import { Http,
XHRBackend,
@AlexVKO
AlexVKO / campaign_on_wishpond_custom_subdomain
Created June 22, 2017 00:19
WORKS: going through http://merchant-wishpond-com.custom.lvh.me/photo-contest/ when `campaign_on_wishpond_custom_subdomain`
20:30:24 v1_rails.1 | PageCache Load (0.3ms) SELECT `page_caches`.* FROM `page_caches` WHERE `page_caches`.`id` = 12 LIMIT 1
20:30:24 v1_rails.1 | Executing Utilities::PhantomJS.download_page with command_line=timeout 60 phantomjs --ignore-ssl-errors=true --ssl-protocol=any /Users/alexvko/Dropbox/workspace/wishpond/wishpondv1/lib/phantomjs_download_page.js https://www.lvh.me/lp/15/\?bot\=true /var/folders/n7/ddmtw02s72x_06dzk0_m5nq80000gp/T/phantomjs-download-20170621-5744-h7ysas
20:30:24 v1_rails.1 | InstagramSubscription Load (0.3ms) SELECT `instagram_subscriptions`.* FROM `instagram_subscriptions` WHERE `instagram_subscriptions`.`status` = 1 ORDER BY `instagram_subscriptions`.`id` ASC LIMIT 1000
20:30:24 v1_rails.1 | [time:0.000]
20:30:24 v1_rails.1 | [time:0.000]
20:30:24 v1_rails.1 | [time:0.000] Started GET "/photo-contest/" for 127.0.0.1 at 2017-06-21 20:30:24 -0300
20:30:24 v1_rails.1 | [time:0.056] DomainRouter: http:
@AlexVKO
AlexVKO / 1-server.md
Created April 20, 2017 21:19 — forked from dragonjet/1-server.md
Setup Web Server on EC2 Amazon Linux AMI

Step 1: Server Credentials

This assumes you are now connected to the server via SSH.

  • sudo -s Enter root mode for admin access
  • groupadd devgroup Create new group to be later granted access to /var/www/html

Creating a new Root User

  • useradd -G root,devgroup masterdev Create new root user. Also add to the devgroup
  • passwd masterdev Change password for the new root user
  • At this point, you'll need to input your new root user's new password
@AlexVKO
AlexVKO / recursion.ex
Created March 2, 2017 18:45
elixir recursion example
defmodule BackOfficeApp.Customer do
use BackOfficeApp.Web, :model
@primary_key {:id, :binary_id, autogenerate: true}
schema "customers" do
field :title, :string
field :first_name, :string
field :middle_name, :string
field :last_name, :string
@AlexVKO
AlexVKO / recursion.ex
Created March 2, 2017 18:45
elixir recursion example
defmodule BackOfficeApp.Customer do
use BackOfficeApp.Web, :model
@primary_key {:id, :binary_id, autogenerate: true}
schema "customers" do
field :title, :string
field :first_name, :string
field :middle_name, :string
field :last_name, :string
------ QUICKBOOKS-RUBY REQUEST ------
METHOD = get
RESOURCE = https://sandbox-quickbooks.api.intuit.com/v3/company/193514473450094/query?query=SELECT+*+FROM+Customer+STARTPOSITION+1+MAXRESULTS+20
REQUEST BODY:
{}
REQUEST HEADERS = {"Content-Type"=>"application/xml", "Accept"=>"application/xml", "Accept-Encoding"=>"gzip, deflate"}
------ QUICKBOOKS-RUBY RESPONSE ------
RESPONSE CODE = 401
RESPONSE BODY:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@AlexVKO
AlexVKO / .gitconfig
Last active December 21, 2016 20:12
[core]
autocrlf = input
excludesfile = /Users/alexvko/.gitignore
editor = vim
pager = diff-so-fancy | less --tabs=4 -RFX
[heroku]
[push]
default = simple
[difftool "ksdiff"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
@AlexVKO
AlexVKO / ar_to_hash.rb
Created December 19, 2016 16:05 — forked from renancarvalhoo/ar_to_hash.rb
Convert any Activerecord to a hash with all it's related objects
class Serializer < Struct.new(:object)
#w.association_cache.keys.include?
def to_hash
@hash ||= hash_object(object)
end
private
def hash_object(object)
hash = {}
@AlexVKO
AlexVKO / .gitconfig
Created October 20, 2016 18:58 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
[
{ "keys": ["e", "u"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
{ "keys": ["c"], "command": "enter_insert_mode",