Skip to content

Instantly share code, notes, and snippets.

View slawosz's full-sized avatar

Sławosz Sławiński slawosz

View GitHub Profile
@slawosz
slawosz / QuickStart.md
Created July 29, 2018 18:53
How to use emailwizard.sh
  1. Clone this repo: git clone git@github.com:emailwizard/emailwizard_essentials.git
  2. In cloned repo directory run docker run -v pwd:/repo -p 9800:9800 emailwizard/emailwizard.sh
  3. Go to http://localhost:9800
  4. Preview some template
# old rails
Model.find(:all, conditions: [...], order: "...")
default_scope
named_scope
# new rails
Model.where(..).order(..).where(..)
##

How to connect to mysql? Normally, this would be enough:

$ mysql -uroot -p this is simplest way. If your user is not root, than check your user name and substitute root with this username.

If you want to connect to database after login, do $ mysql -uroot -p mydbname

To apply dump, do:

$ mysql -uroot -p mydbname < dumpfile.sql

@slawosz
slawosz / 0_reuse_code.js
Created August 1, 2016 11:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@slawosz
slawosz / super.rb
Last active January 2, 2016 15:08
module Foo
def foo
super
puts "super"
end
end
module Baz
def foo
puts "foo"
# global obj instance (instance of Object class)
puts self
# instance of class Class, so we can have objects of this class
class Klass
@foo = 'bar'
puts self #(Klass itself)
# we create instance method
# or (more precisly) method in current self
def foo
@slawosz
slawosz / multiple_sources_proxy.go
Last active December 26, 2015 11:08
Various go research scripts: * reading http request
package main
import (
"net/http"
"bytes"
"bufio"
"net/http/httputil"
"fmt"
"log"
@slawosz
slawosz / singletons.rb
Last active December 26, 2015 05:18
ruby mistery
# self
class Foo
# self
# belongs_to
def Foo.foo
@bla = '123'
puts 'bla'
end
module A
class Foo
def foo
puts 'foo'
end
end
end
module B
include A
@slawosz
slawosz / why-go.md
Last active December 25, 2015 14:39
Why go programming language is so awesome?

I was asked once by https://github.com/jjperezaguinaga:

I am of the impression that you have a strong love fan for Go.
What's so cool about it? I'm kind of curious.

So here are my anwsers:

  • easy to learn: http://tour.golang.org took me about 15 hours to complete (with browsing documentation)
  • language is easy and minimalistic
  • awesome standard library