Skip to content

Instantly share code, notes, and snippets.

View malev's full-sized avatar

Marcos Vanetta malev

View GitHub Profile
@malev
malev / gist:717092
Created November 26, 2010 19:00
Include in Ruby
module MyModule
def my_method(variable)
puts "the variable is " + variable.to_s
end
end
class Clase
include MyModule
@malev
malev / nginx
Created February 26, 2012 19:17
/etc/init.d/nginx file!
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
@malev
malev / nginx.conf
Created February 26, 2012 19:21
nginx.conf file
user malev rvm;
worker_processes 2;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11;
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby;
include mime.types;
@malev
malev / infofund.conf
Created February 26, 2012 19:27
infofund.conf
server {
listen 80;
server_name midominio.com www.midominio.com mialias.com www.mialias.com;
root /opt/nginx/html/infofund/public;
access_log /opt/nginx/html/infofund/log/infofund.access.log;
error_log /opt/nginx/html/infofund/log/infofund.error.log;
rewrite_log on;
@malev
malev / gist:1967208
Created March 3, 2012 18:16
Mustache example
var template = "
<h1>{{header}}</h1>
{{#bug}}
{{/bug}}
{{#items}}
{{#first}}
<li><strong>{{name}}\</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
@malev
malev / gist:1967225
Created March 3, 2012 18:18
2nd mustach example
var helpers = {
truncate: function (str) {
if (str.length > 400) {
return str.slice(0, 400) + "...";
} else {
return str;
}
}
}
var template = "<div class='description'>{{#truncate}}{{item.description}}{{/truncate}}</div>";
@malev
malev / gist:1967260
Created March 3, 2012 18:22
3rd Mustache example
<script type='text/html' id='template'>
<div class='description'>{{#truncate}}{{item.description}}{{/truncate}}</div>
</script>
@malev
malev / infofund.conf
Created April 8, 2012 19:36
nginx.conf file for a virtual host
server {
listen 80;
server_name example.com www.example.com;
root /home/malev/sites/infofund/current/public;
access_log /home/malev/sites/infofund/current/log/infofund.access.log;
error_log /home/malev/sites/infofund/current/log/infofund.error.log;
rewrite_log on;
passenger_enabled on;
}
@malev
malev / php5-fcgi
Created April 13, 2012 04:49
/etc/init.d/php5-fcgi
#!/bin/sh
PHP_SCRIPT=/usr/bin/php5-fcgi
RETVAL=0
case "$1" in
start)
echo "Starting fastcgi"
$PHP_SCRIPT
RETVAL=$?
;;
stop)
@malev
malev / mycoolblog.conf
Created April 13, 2012 04:57
Nginx conf file
server {
listen 80;
server_name *.mycoolblog.com mycoolblog.com www.mycoolblog.com;
root /home/malev/blog/current/;
try_files $uri $uri/ /index.php;
location / {
index index.html index.htm index.php;
}