SelfThis https://selfthis.com Geekery by Joon You Fri, 08 May 2020 12:58:07 +0000 en-US hourly 1 https://wordpress.org/?v=5.3.20 Long Ago, When I Was Working on iOS Apps https://selfthis.com/2020/05/08/long-ago-when-i-was-working-on-ios-apps/ Fri, 08 May 2020 12:58:07 +0000 https://selfthis.com/?p=1498

ios-195 from Joon You on Vimeo.

]]>
Ruby 2.0 – Prepending Module https://selfthis.com/2020/03/30/ruby-2-0-prepending-module-2/ https://selfthis.com/2020/03/30/ruby-2-0-prepending-module-2/#respond Mon, 30 Mar 2020 14:51:34 +0000 https://selfthis.com/?p=1495
]]>
https://selfthis.com/2020/03/30/ruby-2-0-prepending-module-2/feed/ 0
NeXT Me https://selfthis.com/2020/01/25/next-me/ Sun, 26 Jan 2020 02:24:06 +0000 https://www.selfthis.com/?p=1489 ]]> Swagger with Docker https://selfthis.com/2019/04/05/swagger-with-docker/ Fri, 05 Apr 2019 23:06:22 +0000 https://www.selfthis.com/?p=1483

]]>
Flush ActiveRecord database in Rails app https://selfthis.com/2019/04/05/flush-activerecord-database-in-rails-app/ Fri, 05 Apr 2019 21:16:14 +0000 https://www.selfthis.com/?p=1481

]]>
Ruby Array https://selfthis.com/2018/05/03/ruby-array/ Thu, 03 May 2018 11:46:28 +0000 https://www.selfthis.com/?p=1478 Was curious which is faster.

Rehearsal ----------------------------------------------
<<           0.099701   0.017560   0.117261 (  0.117427)
push         0.110768   0.007844   0.118612 (  0.118719)
------------------------------------- total: 0.235873sec

                 user     system      total        real
<<           0.063531   0.002646   0.066177 (  0.066220)
push         0.099184   0.004992   0.104176 (  0.104228)

Code:

require 'benchmark'

Benchmark.bmbm(10) do |bm|
  bm.report('<<') do
    a = []
    1000000.times do
      a << 'foo'
    end
  end

  bm.report('push') do
    a = []
    1000000.times do
      a.push 'foo'
    end
  end
end

]]>
My Language Ranking Based on Coolness https://selfthis.com/2016/10/19/my-language-ranking-based-on-coolness/ https://selfthis.com/2016/10/19/my-language-ranking-based-on-coolness/#comments Wed, 19 Oct 2016 13:31:03 +0000 https://www.selfthis.com/?p=1464 With so many sites measuring programming language popularity, here’s the coolness, not popularity ranking of languages ranking by me. This is my PERSONAL opinion.

1. Ruby – need I say more? 😉
2. Objective-C
3. Go
4. C, not C++
5. Coffeescript – yes, I said it, ok?
6. Haskell
7. R
8. Swift

]]>
https://selfthis.com/2016/10/19/my-language-ranking-based-on-coolness/feed/ 1
Install Ruby 2.3.1 from Source on Ubuntu 16.04 https://selfthis.com/2016/09/09/install-ruby-2-3-1-from-source-on-ubuntu-16-04/ Fri, 09 Sep 2016 18:21:05 +0000 https://www.selfthis.com/?p=1461 Execute this as the root user. If not, you can always add sudo. Here’s the script:


#!/bin/bash

set -e

apt-get update
apt-get install -y curl build-essential libreadline-dev \
libffi-dev zlib1g-dev openssl vim \
libncurses5-dev libcurl4-openssl-dev \
libgdbm-dev libqdbm-dev libssl-dev
apt-get autoremove && apt-get autoclean
curl -O https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar xvzf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure
make && make install
cd ..
rm -rf ruby-2.3.1*
echo "gem: --no-ri --no-rdoc
install: --no-ri --no-rdoc
update: --no-ri --no-rdoc" > /usr/local/etc/gemrc

gem install bundler pry interactive_editor

]]>
Setting Up a React Project https://selfthis.com/2016/05/14/setting-up-a-react-project/ Sat, 14 May 2016 23:02:59 +0000 https://www.selfthis.com/?p=1451

$ brew update && brew install node
$ npm -g install bower
$ bower install react babel

Create index.htm and link react.js and browser.js.

]]>
Simple Web Server with Ruby or Python https://selfthis.com/2016/04/30/simple-web-server-with-ruby-or-python/ Sat, 30 Apr 2016 20:59:21 +0000 https://www.selfthis.com/?p=1447 I was developing a Javascript app and wanted to run a web server pointing to current directory.

Using Ruby

A simple script to start a WEBrick server. You can modify the root directory to a subfolder if you’d like. I named this script “server” with chmod +x so I can run it with ./server

#!/usr/bin/env ruby

require 'webrick'

server = WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: ".")
Signal.trap('INT') { server.shutdown }
server.start

Python

A simple command using python -m SimpleHTTPServer

]]>