Skip to content

Instantly share code, notes, and snippets.

View mogetutu's full-sized avatar

Isaak Mogetutu mogetutu

View GitHub Profile
@mogetutu
mogetutu / counter.js
Created March 17, 2017 06:44 — forked from yuya-takeyama/counter.js
Closure examples.
// This works on Rhino.
var counter = (function () {
var i = 1;
return function () {
return i++;
};
})();
print(counter()); // 1
@mogetutu
mogetutu / deploy.rb
Created July 4, 2016 06:25
Deply Rails App with Puma and Nginx via Mina
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'esdb.cn'
set :identity_file, '/User/somebody/.ssh/somebody.pem'
set :deploy_to, '/home/ubuntu/apps/xxx.com'
set :repository, 'ssh://git@bitbucket.org/somebody/xxx.com.git'
set :branch, 'master'
@mogetutu
mogetutu / digital_ocean_setup.md
Created June 15, 2016 02:35 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@mogetutu
mogetutu / install.md
Last active February 29, 2016 18:14 — forked from galulex/install.md
Ruby On Rails Ubuntu 14.04 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev libmagickwand-dev imagemagick libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs nodejs-legacy rar libgmp-dev

Ruby

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update

@mogetutu
mogetutu / nvm.md
Last active February 24, 2016 06:55
Install NVM - Lastest Node & npm

Also, since nvm uses the name "node" instead of "nodejs", make sure that the unrelated program also named "node" -- the Amateur Packet Radio -- does not already exist on your system.

sudo apt-get install git build-essential libssl-dev curl git-core
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash

(I determined the latest nvm version available -- and a lot of other, really helpful information -- at: https://github.com/creationix/nvm)

@mogetutu
mogetutu / rspec_model_testing_template.rb
Created February 5, 2016 08:05 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:

Have a writable folder public/blog_images in you app.

###routes.php

// Redactor Blog Upload
Route::post('redactorUpload', function()
{
    $file = Input::file('file');
    $fileName = $file->getClientOriginalName();
 
@mogetutu
mogetutu / nginx-config-rails4-with-puma-ssl-version.conf
Created January 18, 2016 21:55 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@mogetutu
mogetutu / xml_example.xml
Created October 11, 2013 13:40
Xml formatting for nick
<?xml version="1.0" encoding="ISO-8859-1"?>
<email>
<to>Nico</to>
<from>Nigga</from>
<subject>Reminder</subject>
<body>Nigga try express yourself better, kisungu ngumu</body>
</email>
<!-- this is simple formatting of the xml syntax -->
<root>