This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Note < Struct.new(:name, :text, :shared) | |
def share | |
self.shared = !self.shared | |
end | |
end | |
class Notebook | |
attr_accessor :notes | |
def initialize | |
@notes = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( $('#tasks').length ) { | |
$('#tasks').html("<%= j render 'projects/tasks' %>"); | |
$('#task_title').val(""); | |
} | |
else if ( $('#subtasks').length ) { | |
$('#subtasks').html("<%= j render 'subtasks' %>"); | |
$('#task_title').val(""); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainController < ApplicationController | |
def index | |
end | |
def generate | |
gpg = OpenPGP::Engine::GnuPG.new | |
key_id = gpg.gen_key({ | |
key_type: 'DSA', | |
key_length: 2048, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'open-uri' | |
require 'pp' | |
class Package | |
attr_accessor :name, :deps | |
def initialize(name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'open-uri' | |
require 'pp' | |
class Package | |
attr_accessor :name, :deps | |
def initialize(name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) : (""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= 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 |
OlderNewer