Skip to content

Instantly share code, notes, and snippets.

@shime
shime / readme.md
Created September 30, 2014 14:15
run the minitest test suite without rake

To run bunch of Minitest tests in one go, without using Rake, use this command

$ ruby -e 'ARGV.each { |path| require "./#{path}" }' test/*.rb

@shime
shime / ngnix.conf
Created October 31, 2014 10:29
redirect non-www to www with or without ssl in ngnix
# http://domain.com -> https://www.domain.com
# http://www.domain.com -> https://www.domain.com
server {
listen 80;
server_name domain.com www.domain.com;
return 301 https://www.domain.com$request_uri;
}
# https://domain.com -> https://www.domain.com
server {
@shime
shime / kata.md
Created November 19, 2014 21:40
text from kata at http://www.codewars.com/kata/a-chain-adding-function/. solution is in 3 lines of code.

We want to create a function that will add numbers together when called in succession.

add(1)(2) == 3 // true

We also want to be able to continue to add numbers to our chain.

add(1)(2)(3) == 6 // true

Keybase proof

I hereby claim:

  • I am shime on github.
  • I am shime (https://keybase.io/shime) on keybase.
  • I have a public key whose fingerprint is 3032 0F07 65F2 3ABC 8BCB 3AF6 D409 B2B4 1F90 597C

To claim this, I am signing this object:

@shime
shime / Dockerfile
Last active August 29, 2015 14:18
confiig files
FROM base/archlinux:latest
# install dependencies
RUN pacman -Syu --noconfirm
RUN pacman --noconfirm -S base-devel yajl nodejs git openssh imagemagick python2
RUN ln -s /usr/bin/python2 /usr/bin/python
# install yaourt
WORKDIR /tmp/scratch
RUN curl https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz | tar zx
@shime
shime / readme.md
Last active August 29, 2015 14:23
debugging Ember components and views in the newer Ember versions
@shime
shime / gist:1077934
Created July 12, 2011 13:04
Initialize compass in new rails app
compass init rails . --using blueprint
@shime
shime / instance_eval explanation.rb
Created January 14, 2012 00:14
instance_eval explanation
val = "pizdarija"
val.randomize
val.instance_eval do
def randomize
split(//).to_a.shuffle.join
end
#include <stdio.h>
int main(){
srand(time(NULL));
int i = 0;
int random;
for (i=0;i < 10;i++){
random = rand()%1000;
printf("%d\n",random);
}
return 0;