Skip to content

Instantly share code, notes, and snippets.

View Gurpartap's full-sized avatar
:octocat:
Working from home

Gurpartap Singh Gurpartap

:octocat:
Working from home
View GitHub Profile
- (void)setCallbackBlock:(void (^)(id object))callbackBlock
{
//set block as an attribute in runtime
if (callbackBlock) {
objc_setAssociatedObject(self, "dismissBlockCallback", [callbackBlock copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
return;
}
void (^block)(id obj) = objc_getAssociatedObject(self, "dismissBlockCallback");
FROM gurpartap/ruby-build:2.1.2
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
RUN bundle install
ADD . /myapp
EXPOSE 3000
CMD bundle exec thin start
@Gurpartap
Gurpartap / gist:594c5f685664706f4cf8
Last active August 29, 2015 14:05
docker build ./ruby-build
Sending build context to Docker daemon 3.584 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04.1
---> c4ff7513909d
Step 1 : MAINTAINER Gurpartap Singh <hi@gurpartap.com>
---> Running in 735544a373de
---> 61ea77fe88b6
Removing intermediate container 735544a373de
Step 2 : ENV HOME /root
---> Running in 630924cf2e99
FROM gurpartap/ruby-build:2.1.2
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
RUN bundle install
ADD . /app
EXPOSE 3000
CMD bundle exec thin start
@Gurpartap
Gurpartap / gist:6462e56f9341a88bd891
Last active August 29, 2015 14:05
docker build ./sample-app
Sending build context to Docker daemon 4.608 kB
Sending build context to Docker daemon
Step 0 : FROM gurpartap/ruby-build:2.1.2
---> 5c56e02d05ba
Step 1 : RUN mkdir /app
---> Running in 0a041a4be9b5
---> 9fc3f783bf3c
Removing intermediate container 0a041a4be9b5
Step 2 : WORKDIR /app
---> Running in 41c90ff81f3c
web_1 | Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
web_1 | /redismachine-web/.bundle/ruby/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `require': cannot load such file -- rubyeventmachine (LoadError)
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `<top (required)>'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/gems/thin-1.6.2/lib/thin.rb:7:in `require'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/gems/thin-1.6.2/lib/thin.rb:7:in `<top (required)>'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/gems/thin-1.6.2/bin/thin:5:in `require'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/gems/thin-1.6.2/bin/thin:5:in `<top (required)>'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/bin/thin:23:in `load'
web_1 | from /redismachine-web/.bundle/ruby/2.1.0/bin/thin:23:in `<main>'
@Gurpartap
Gurpartap / Dockerfile
Last active August 29, 2015 14:06
Ruby Sinatra docker app for (not just) Kitematic
FROM ubuntu:14.04
RUN apt-get update -qq && \
apt-get install -y make curl -qq && \
apt-get clean && \
curl -sSL "https://github.com/postmodern/ruby-install/archive/master.tar.gz" -o /tmp/ruby-install-master.tar.gz && \
cd /tmp && tar -zxvf ruby-install-master.tar.gz && \
cd /tmp/ruby-install-master && make install && \
apt-get update && \
echo "gem: --no-rdoc --no-ri" >> ~/.gemrc && \
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3" # parallels/boot2docker recommendation.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "mitchellh/boot2docker"
config.vm.box_version = "1.2.0"
@Gurpartap
Gurpartap / guestbook-controller.json
Last active August 29, 2015 14:06
Kubernetes Guestbook manifests
core@master ~ $ kubecfg -c redis-master-pod.json create pods
core@master ~ $ kubecfg -c redis-master-service.json create services
core@master ~ $ kubecfg -c redis-slave-controller.json create replicationControllers
core@master ~ $ # ...
core@master ~ $ kubecfg list minions
Minion identifier
----------
172.17.8.101
172.17.8.102
core@master ~ $ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.100.83.1 netmask 255.255.255.0 broadcast 0.0.0.0
ether 56:84:7a:fe:97:99 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500