This file contains 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/bash | |
. /etc/rc.conf | |
. /etc/rc.d/functions | |
. /etc/profile | |
DAEMON=prozatorium | |
PIDFILE=/path/to/pidfile | |
app_path=/path/to/rails_app | |
config=config/puma.rb |
This file contains 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
/** | |
* jQuery background position plugin | |
* adapted to width recalculation | |
* original by Alexander Farkas | |
*/ | |
(function($) { | |
Tween = jQuery.Tween; | |
jQuery.Tween.prototype.run = function( percent ) { | |
var eased, |
This file contains 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
# From: http://nerdblog.pl/post/120106238519/node-on-execjs-is-sloooooow | |
# with bmbm | |
# 2 + 2 | |
Rehearsal ------------------------------------------------ | |
node.js 0.080000 0.010000 0.090000 ( 0.080896) | |
therubyracer 0.060000 0.010000 0.070000 ( 0.065395) | |
--------------------------------------- total: 0.160000sec |
This file contains 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
import std.stdio, std.socket, std.socketstream, std.stream, std.string, std.conv; | |
import dproto.dproto; | |
const proto_def = import("ql2.proto"); | |
mixin ProtocolBufferFromString!proto_def; | |
void main() | |
{ | |
auto socket = new TcpSocket(AddressFamily.INET); | |
socket.connect(new InternetAddress("localhost", 28015)); |
This file contains 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
[44/396] CC build/release/obj/clustering/table_manager/multi_table_manager.o | |
In file included from ./src/clustering/administration/servers/server_metadata.hpp:10:0, | |
from ./src/clustering/administration/tables/table_metadata.hpp:12, | |
from ./src/clustering/table_contract/contract_metadata.hpp:12, | |
from ./src/clustering/table_contract/coordinator/coordinator.hpp:6, | |
from ./src/clustering/table_manager/table_manager.hpp:5, | |
from ./src/clustering/table_manager/multi_table_manager.hpp:8, | |
from src/clustering/table_manager/multi_table_manager.cc:2: | |
./src/rpc/mailbox/typed.hpp: In member function ‘void mailbox_t<void(a0_t, a1_t, a2_t, a3_t, a4_t, a5_t, a6_t, a7_t)>::read_impl_t::read(read_stream_t*, signal_t*) [with arg0_t = uuid_u; arg1_t = multi_table_manager_timestamp_t; arg2_t = multi_table_manager_bcard_t::status_t; arg3_t = boost::optional<table_basic_config_t>; arg4_t = boost::optional<raft_member_id_t>; arg5_t |
This file contains 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
@image_type = params[:image][:type] ? params[:image][:type] : nil | |
@show_uploader = params[:uploader] == 'false' ? false : true |
This file contains 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
# Which pattern-matching syntax you think is better in Ruby? | |
# | |
# Some background: | |
# - https://github.com/katafrakt/noaidi | |
# - http://katafrakt.me/2016/02/13/quest-for-pattern-matching-in-ruby/ | |
# - http://katafrakt.me/2016/05/24/refactoring-rails-with-noaidi/ | |
# Syntax 1: |
This file contains 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
require 'rom' | |
require 'rom/sql' | |
require 'pg' | |
# Assuming a database with tables 'users' and 'projects' | |
rom = ROM.container(:sql, 'postgres://localhost/test') | |
# | |
# # Perhaps one Repo to handle users | |
class UserRepo < ROM::Repository[:users] | |
end |
This file contains 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 Vcard | |
attr_reader :imie, :nazwisko, :firma, :telefon | |
def show | |
if not @imie | |
puts "Dane niezaładowane" | |
else | |
puts @imie + " " + @nazwisko | |
puts @firma | |
puts @telefon | |
end |
This file contains 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 Program < Hash | |
Recv = Class.new(StandardError) | |
attr_reader :last_sound | |
def set(reg, val) | |
self[reg] = value(val) | |
end | |
def add(reg, val) | |
self[reg] += value(val) |
OlderNewer