Skip to content

Instantly share code, notes, and snippets.

class Note < Struct.new(:name, :text, :shared)
def share
self.shared = !self.shared
end
end
class Notebook
attr_accessor :notes
def initialize
@notes = []
@odinsy
odinsy / nginx
Created October 9, 2015 07:32 — forked from mustafaturan/nginx
Nginx Init Script Centos 6
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# 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
if ( $('#tasks').length ) {
$('#tasks').html("<%= j render 'projects/tasks' %>");
$('#task_title').val("");
}
else if ( $('#subtasks').length ) {
$('#subtasks').html("<%= j render 'subtasks' %>");
$('#task_title').val("");
}
class MainController < ApplicationController
def index
end
def generate
gpg = OpenPGP::Engine::GnuPG.new
key_id = gpg.gen_key({
key_type: 'DSA',
key_length: 2048,
$(document).ready(function() {
$('.hide-projects').click(function() {
$('#projects').toggle();
$(this).toggleClass('glyphicon-menu-right glyphicon-menu-down');
});
$('.hide-completed').click(function() {
$('.completed').toggle();
$(this).toggleClass('glyphicon-menu-right glyphicon-menu-down');
});
});
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
require 'pp'
class Package
attr_accessor :name, :deps
def initialize(name)
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
require 'pp'
class Package
attr_accessor :name, :deps
def initialize(name)
#!/usr/bin/env ruby
module Parser
SSH_REGEX = [/ssh\s+\w+([-+.']\w+)*@\w+([-.]\w+)*/, /ssh\s+\w+([-.]\w+)*([\s+\$])/].freeze
CONN_REGEX = /\w+([-+.']\w+)*@\w+([-.]\w+)*/
def parse(path)
File.open(path).select { |line| line.valid_encoding? && line.match(SSH_REGEX[0]) }.map { |line| line[CONN_REGEX] }
end
open(my $fh, '<:encoding(UTF-8)', $report)
or die "Could not open file '$report' $!";
while (my $row = <$fh>) {
chomp $row;
my ($tld, $domain, $updated, $created, $expire, $ns, $status, $appendix) = split /:/, $row;
my $name = (split /\./, $domain)[0];
my @status_list = ($status =~ m/\|/)? split(/\|/, $status) : ($status);
my @ns_list = ($ns =~ m/\|/)? split(/\|/, $ns) : ("");
<%= f.simple_fields_for @deck do |deck| %>
<%= deck.input :title, label: "Или создайте новую" %>
<%= deck.input :current %>
<% end %>
def create
if card_params[:deck_id].empty?
@deck = current_user.decks.create(card_params[:deck])
else