Skip to content

Instantly share code, notes, and snippets.

View AnatoliiD's full-sized avatar
🇺🇦

Anatolii Didukh AnatoliiD

🇺🇦
  • Norway, Jørpeland
View GitHub Profile
FROM golang:1.8.5-jessie as builder
# install xz
RUN apt-get update && apt-get install -y \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# install UPX
ADD https://github.com/upx/upx/releases/download/v3.94/upx-3.94-amd64_linux.tar.xz /usr/local
RUN xz -d -c /usr/local/upx-3.94-amd64_linux.tar.xz | \
tar -xOf - upx-3.94-amd64_linux/upx > /bin/upx && \
chmod a+x /bin/upx
@AnatoliiD
AnatoliiD / namespacing.rb
Created October 14, 2016 07:30
Namespacing and reusage of overriden classes.
class Overriden
class << self
def a
'GLOBAL'
end
end
end
module A
class Overriden
@AnatoliiD
AnatoliiD / last_slash_check_benchmark.rb
Last active June 6, 2016 16:53
Path last slash check benchmark
require 'benchmark/ips'
true_path = '/my_mega_true_path/'
false_path = '/my_mega_false_path'
GC.disable
Benchmark.ips do |bm|
bm.report 'regexp match true' do
true_path =~ /\/$/
1) Start by solving a problem with a well-defined customer first
2) Don't rebuild what already exists
3) Don't spend time budget-gaming ec2 instance types
4) Publish a site that allows signups immediately (before anything else gets built)
5) Buy a simple web app package that bundles a ton of pages for example: http://lit-coast-9918.herokuapp.com/react12/index.html
6) Focus on just one customer type and just one problem (KISS)
7) Engage 100 journalists 2 months before you launch (muck rack / pressfriendly.com and or pay someone to do it). Figure out and pitch the story to them before you reach out to them.
8) Use fiverr and pay a bunch of bloggers/copywriters to publish and blog a ton of stuff and budget it for at least 6 months
9) Start using adroll sooner
10) Minify and compress your javascript (I used http://django-compressor.readthedocs.org/en/latest/)
@AnatoliiD
AnatoliiD / example.rb
Created February 19, 2016 09:18
understanding Hash#fetch
#!/usr/bin/env ruby
def param_method
puts 'I was called both times'
'result'
end
def block_method
puts 'I was called only once'
'result'
end
@AnatoliiD
AnatoliiD / _service.md
Last active January 5, 2016 22:32 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@AnatoliiD
AnatoliiD / yield.rb
Last active October 22, 2015 08:26
yield duplications
class Before
class << self
def method1
puts 'first duplication'
puts 'i am uniq for method 1'
puts 'second duplication'
end
def method2
puts 'first duplication'
puts 'i am uniq for method 2'
package main
import "fmt"
func main() {
var z []int
z2 = []int{}
fmt.Println(z == nil) // prints true
fmt.Println(z2 == nil) // prints false
}