Skip to content

Instantly share code, notes, and snippets.

View mrzasa's full-sized avatar

Maciek Rząsa mrzasa

  • Toptal
  • Rzeszów
View GitHub Profile
DATA.read.gsub(/(\s|)+([!?;]+(\s|\z))/, ' \2\3')
__END__
GET /wp-login.php HTTP/1.1 69
GET /show.aspx HTTP/1.1 15
@kml
kml / regexp_breaking_ruby.rb
Last active December 15, 2022 19:44
Regexp breaking Ruby
# encoding: utf-8
require 'minitest'
require 'minitest/autorun'
describe "regexp" do
let(:regexp) { /(\s*(<p>\s*<\/p>)\s*)+\Z/mi }
it "cleans up trailing empty tag from simple string" do
"X <p> </p> ".gsub(regexp, "").must_equal "X"
@tokenvolt
tokenvolt / simple_form_bootstrap3.rb
Last active November 2, 2023 11:55
Bootstrap 3 simple form initializer
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References
@andreypronin
andreypronin / custom_plan_zeus_rspec.rb
Created April 6, 2013 15:18
Custom_plan.rb and zeus.json for smooth RSpec experience with Zeus.
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def spec(argv=ARGV)
# disable autorun in case the user left it in spec_helper.rb
RSpec::Core::Runner.disable_autorun!
exit RSpec::Core::Runner.run(argv)
end
end
=begin
$ uname -a
Linux jboss-updater2 3.2.21-nkt #1 SMP Wed Aug 1 20:23:57 CEST 2012 x86_64 GNU/Linux
$ java -version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-2)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
$ jruby --version
@ruanltbg
ruanltbg / LAMP.md
Last active August 1, 2016 13:59
Set up of a Rails + Nginx + Unicorn OR LAMP in Ubuntu

Apache

$ sudo apt-get update
$ sudo apt-get install apache2
# activate mod_rewrite
$ sudo a2enmod rewrite
#restart
$ sudo service apache2 restart

Mysql

@prognostikos
prognostikos / app.js
Created September 11, 2012 13:45
AngularJS & Rails
/**
* Angular needs to send the Rails CSRF token with each post request.
*
* Here we get the token from the meta tags (make sure <%= csrf_meta_tags %>
* is present in your layout.)
*/
angular.module('myapp',[]).
// configure our http requests to include the Rails CSRF token
config(["$httpProvider", function(p) {
var m = document.getElementsByTagName('meta');
@thinkerbot
thinkerbot / gem_env.sh
Created November 8, 2010 18:28
Illustrates GEM_HOME vs GEM_PATH
# Two ENV variables control the 'gem' command:
#
# GEM_HOME: the single path to a gem dir where gems are installed
# GEM_PATH: a standard PATH to gem dirs where gems are found
#
# A gem directory is a directory that holds gems. The 'gem' command will lay
# out and utilize the following structure:
#
# bin # installed bin scripts
# cache # .gem files ex: cache/gem_name.gem