Skip to content

Instantly share code, notes, and snippets.

View jeygeethan's full-sized avatar
💭
just. awesome.

Jey Geethan jeygeethan

💭
just. awesome.
View GitHub Profile
@jeygeethan
jeygeethan / rails_engine.md
Last active June 1, 2020 03:06 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
@jeygeethan
jeygeethan / engine.rb
Created January 16, 2019 05:17
Rails Engine - Load migrate path into the host Rails App
module MyEngine
class Engine < ::Rails::Engine
isolate_namespace MyEngine
initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
end
end
@jeygeethan
jeygeethan / hello.rb
Created August 12, 2018 12:54
Find out where a ruby method is defined
module Foo
def say_hello
puts "hello"
end
end
class Bar
include Foo
end
@jeygeethan
jeygeethan / AND_OR_NOT
Created July 15, 2018 05:37 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
# ~/.bash_profile
# Enable colors for the bash -ls command
export CLICOLOR=1
export LSCOLORS="ExfxcxdxExegDxabagacDx"
# Configure terminal formatting colors & styles
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
@jeygeethan
jeygeethan / gist:c17286b0afcc3029d851a926144366da
Created February 25, 2018 11:13
Increase the open file limters on mac OS Sierra
# ~/.bash_profile
# change open file descriptors limit
ulimit -n 65536 200000
@jeygeethan
jeygeethan / simple_server.rb
Created September 14, 2017 06:03
Simple Tcp Http Server in Ruby
require 'socket'
server = TCPServer.new(1234)
while request = server.accept
puts request.gets
request.puts "HTTP/1.1 200 OK\r\n\r\nHello world!"
request.close
end
var Promise = require('bluebird');
function aSync() {
return new Promise(function(resolve, reject) {
setTimeout(function() {
console.log('inside the aSync')
resolve();
}, 3000);
})
}
@jeygeethan
jeygeethan / swarm_join.sh
Last active August 14, 2016 04:37
a script file to create docker engines across a few hosts and join them as nodes
#!/usr/sh
#change these values as necessary
set SWARM_TOKEN=insert_token_here
set SWARM_MANAGE_HOST=10.0.0.4
# install docker-engine on the current machine
sudo apt-get update && sudo apt-get install -y docker-engine && sudo service docker start && sudo docker run hello-world && sudo usermod -aG docker $USER
# join the docker engine to a swarm
@jeygeethan
jeygeethan / reinstall_docker.sh
Last active November 17, 2019 07:11
reinstall docker on any machine
#!/usr/sh
sudo service docker stop && sudo apt-get purge -y docker-engine && sudo apt-get autoremove --purge -y docker-engine && sudo rm -rf /var/lib/docker && sudo apt-get update && sudo apt-get install -y docker-engine && sudo service docker start && sudo docker run hello-world && sudo usermod -aG docker $USER