Its quiet..

Yeah there hasn’t been much activity for a few weeks, but we will be introducing some changes in the coming weeks

IndieTapes.com Partnership

Recently ElectroCode has partnered up with IndieTapes.com to give them and their users another way to interact and connect with each other.

Currently, the network houses a few related channels.

#indietapes – IndieTapes.com Official Channel
#EDM – Skora owned Electronic Dance Music Channel
#dj – The DJ hangout at ElectroCode IRC

Bleh

Unfortunately, but also fortunately, we’re back on via apache, as nginx, to me at least, is more trouble than its worth some times, with the way it doesn’t easily show you errors, nor does thin, which is troublesome when trying to debug a script. Which passenger readily attaches to apache, while thin takes some extra configuring, and has to be restarted for each change in code, which is tedious to say the least.  Passenger on the other hand, in nginx, doesn’t readily attach, nor does nginx register its commands, but in apache, it slips right in, giving tracebacks when you need them, and also always showing the up-to-date code.

 

Few Changes

  1. We’ve switched over to nginx, which I thought we’d never do. Its quite a change, but its doing very well so far.
  2. Scripts domain now goes through nginx->thin->sinatra instead of using passenger, which isn’t well supported on nginx, but now uses a pure ruby middle-man. (thin is a webserver gem)
  3. Some stuff may still need to be worked on or updated, so let us know anywhere you can if something is wrong.

Thanks!

How To: Ruby+Passenger+Sinatra

Starting Off

Note:

Since I can’t put everything in the title, you need to know some things first before you try anything. If you’re going to be using ruby to make a website, or any kind of rails app, with Sinatra or otherwise, its best to go with whats called Passenger which attaches to your running webserver as a mod, for either Apache or nginx, or as a standalone server.

Some Pointers

Your best shot, in my own opinion would to also use a framework, or some could say ‘helper’ to make coding the website easier, the one I’ve found is Sinatra which has many of its own little helpers that can be used.

What you need

Folder Structure

Alright, now that you have them all set up, you need a good folder structure, this makes it easier to move around, and as you’ll see; let Sinatra and Passenger work well. Below is what the directory structure of scripts.electrocode.net looks like.


scripts/
├── botlist.json
├── bot.rb
├── common.motd
├── config.ru
├── def.rules
├── favicon.png
├── my_app.rb
├── public/
├── retrieve.rb
├── style.css
├── templates/
│   └── sass/
│       ├── index.sass
│       ├── layout.sass
│       └── uptime.sass
├── tmp/
│   └── always_restart.txt
└── views/
    ├── bot_form.erb
    ├── botlist.slim
    ├── ddate.slim
    ├── index.slim
    ├── layout.slim
    ├── motd.erb
    ├── retrieve.erb
    ├── rules.erb
    ├── uptime.slim
    └── view_info.slim

Made with tree

Making it Work

If you’re going to use Passenger and Sinatra together, you’re going to need 1(actually 2) starting file(s). config.ru


require './my_app'
run MyApp

my_app.rb


#! /usr/bin/ruby
#
require "sinatra/base"
require "tilt/erb"
require "tilt/slim"
require "tilt/sass"
require "tilt/haml"
require "json"
class SassHandler < Sinatra::Base
  set :views, File.dirname(__FILE__) + '/templates/sass'
  get '/css/*.css' do
    filename = params[:splat].first
    sass filename.to_sym
  end
end
class MyApp < Sinatra::Base
  set :protection, :except => :frame_options
  Slim::Engine.set_options pretty: true
  use SassHandler
  get "/" do
    table = JSON.load(File.open("table.json", "r"))
    slim :index, :locals => {"table" => table}
  end
end
# # start the server if ruby file executed directly
# run! if app_file == $0
# end

This is basically the skeleton that I started with, minus the SassHandler considering that’s how I’m getting css into the templates. Now in order to have some of these helpers, easily, you must have ‘gem’ available on your system. If you haven’t already, you will need to install Sinatra for any of this to work.

gem install sinatra sinatra-json

The json one lets you output json very easily with just Ruby code; More on that in a later post

gem install haml slim sass scss

After they are all installed, then you can start making your index.*

↑ Return to Top

Scripts sub-domain updated

I’ve fixed up the scripts sub-domain so that, only the right IPs can access the motd and rules, as well as making a better index page for the sub-domain.

ZeeRubyWay

Welcome Back

So when I first started the network there was a group of people that came from their respective IRC networks to help me, and donate servers, while some have gone their separate ways, there are some that come back to lend a helping hand after a long hiatus. So far, two of our founding members have come back, much to my surprise.
Continue reading

Merry Christmas! | Matt Mullenweg

I hope it’s filled with lots of comfortable sweaters, like this one..

Source: Merry Christmas! | Matt Mullenweg

 

Thanks Matt, and I’d actually wear that sweater lol

Traditional Looking Buffer List (WeeChat)

First, you’ll want to be in at least the 1.0 version of weechat. As this tutorial is based off usage in that version. Second, you will need to do a some things to get the client ready for the change.
/set irc.look.server_buffer independent
What this does is it makes it so you can make each server’s buffer independent (otherwise server stuff for all servers, goes to every server buffer) ​Third, you’ll need to install the scripts “autosort.py” and “buffers.pl” if you don’t already have them.
/script install autosort.py buffers.pl
Then, these should be put in.
/set buffers.look.show_number off
Because who wants their buffers numbered (not me at least)
/set buffers.look.indenting on
This allows the right kind of indenting hierarchy to take place (core/weechat->server->channels+queries) And then you should be good.

If you have any questions about this page, or want to suggest corrections, feel free to contact me,

Contact: Email: http://electrocode.net/contact-us
(Social Media)
or on IRC via irc://irc.electrocode.net/chat


  • If this page or post could use some sprucing up, let us know by contacting us through this link