Skip to content

Instantly share code, notes, and snippets.

View samuelralak's full-sized avatar

Samuel Ralak samuelralak

View GitHub Profile
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@samuelralak
samuelralak / MongoDB Installation
Created March 31, 2014 18:14
Installing mongodb in ubuntu linux
1. Add 10gen package to source.list.d
Ubuntu 12 comes with a “mongo” package, but not the latest version.
$ sudo apt-cache search mongodb
mongodb
mongodb-clients
mongodb-dev
mongodb-server
It’s recommended to add 10gen package to /etc/apt/sources.list.d, as it contains the latest stable MongoDB. Create a /etc/apt/sources.list.d/mongo.list file, and declared the 10gen distro.
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
<!DOCTYPE html>
<html>
<head>
<title>My Rails App</title>
<%- if protect_against_forgery? -%>
<meta name="authenticity-token" id="authenticity-token" content="<%= form_authenticity_token %>" />
<%- end -%>
<%= javascript_include_tag 'jquery', 'rails' %>
</head>
<body>
@samuelralak
samuelralak / gvm_installation
Created August 7, 2015 10:29
installing go using gvm
1. Clone the Repo and Add to User Directory
1
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
This command uses cURL to grab the GitHub repo and install it into your user directory. The file that this repo is placed in is ~/.gvm.
2. Open Your ~/.bashrc and Source the GVM Directory
1
upstream puma {
server unix:///home/deploy/apps/avtomat_kalashnikova/shared/tmp/sockets/avtomat_kalashnikova-puma.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /home/deploy/apps/avtomat_kalashnikova/current/public;
access_log /home/deploy/apps/avtomat_kalashnikova/current/log/nginx.access.log;
@samuelralak
samuelralak / localhost.conf
Last active September 8, 2015 20:46 — forked from jtadeulopes/localhost.conf
Default nginx server
upstream project {
server unix:///home/deploy/apps/avtomat_kalashnikova/shared/tmp/sockets/avtomat_kalashnikova-puma.sock;
}
server {
listen 80;
server_name localhost;
root /home/deploy/apps/avtomat_kalashnikova/current/public;
module AmazonSignature
extend self
def signature
Base64.encode64(
OpenSSL::HMAC.digest(
OpenSSL::Digest.new('sha1'),
AWS_CONFIG['secret_access_key'], self.policy
)
).gsub("\n", "")