Skip to content

Instantly share code, notes, and snippets.

View papricek's full-sized avatar

Patrik Jíra papricek

  • http://www.patrikjira.com
  • Prague
View GitHub Profile
<div class="clearfix text-right" style="width: 100%">
<a href="#" class="text-blue btn">Přihlášení</a>
<a href="#" class="text-blue btn">Registrace</a>
</div>
@papricek
papricek / autoexec.cfg
Last active October 25, 2019 07:37
Counter Strike Global Offensive Config
// budi's CS:GO config
// Updated 7/1/2019
// Rates
rate "786432" // max rate, lower if having network issues
cl_cmdrate "128"
cl_updaterate "128"
cl_interp "0.0"
cl_interp_ratio "1"
cl_interpolate "1"
@papricek
papricek / variables.yml
Created April 24, 2018 09:19
Variables to be edited by analytic power
---
:line_fields:
:general:
:lines:
obchodni_nazev_ID7:
:cg_name: ID7
:cg_type: text
:cg_test_data: HEINEKEN SLOVENSKO
:cg_description: Obchodní název
:label_cs: Obchodní název
@papricek
papricek / Gemfile
Created September 30, 2013 16:11
How to setup an easy test suite.
# ./Gemfile
...
group :test do
gem "shoulda-context"
gem "shoulda-matchers"
gem "factory_girl_rails"
gem "mocha"
gem "ffaker"
class AnonymousUser < User
attr_accessible *ACCESSIBLE_ATTRS, :type, :token, as: :registrant
def register(params)
params = params.merge(type: 'User', token: nil)
self.update_attributes(params, as: :registrant)
end
end
# You just put this in config/initializers. Dont create text.erb files! ;)
# Text parts are auto-generated from html.erb templates.
include ActionView::Helpers::SanitizeHelper
class TextMailInterceptor
def self.delivering_email(message)
html = message.html_part.try(:body).try(:to_s) || message.body.to_s
text = HTMLEntities.new.decode(html).gsub(/<a.+?href=("|')([^"']+).*?>(.+?)<\/a>/, "\\2: \\3")
attachments = message.attachments
@papricek
papricek / gist:3418963
Created August 21, 2012 20:08
Sample .gitignore file for kinda typical rails app
# What are .gitignore files for? Well, not everything should be stored in a repo.
# Typically your IDE files, log files, or database related stuff (like paperclip attachments in public/system)
.DS_Store # because Mac file system
/.rvmrc # when you have .rvmrc file with default rails and gemset
/.idea # RubyMine project stuff
/.bundle # Bundler temp stuff
/db/*.sqlite3 # DB file, when using sqlite
/config/database.yml # db config - this is probably the only line here, that not including is both bad practice and dangerous
/log/*.log # wanna store gigabytes of logs in repo? c'mon...
@papricek
papricek / gist:1704844
Created January 30, 2012 14:59
What a syntax sugar!
def in_action?(actions)
actions = [actions] if actions.is_a?(String)
actions.map(&:to_s).include?(params[:action])
end
<a href="http://www.rajremesel.cz" style="text-align:center;" title="Další libovolnej text">
<img src="http://www.rajremesel.cz/media/logosmall-transparent.png" alt="Popisek loga takže asi něco jako RájŘemesel.cz"><br />
Text si doplň dle libosti Ládí
</a>
@papricek
papricek / gist:1518887
Created December 25, 2011 08:33
Render tree within a single sql query
def render_tree(nodes = [])
stack = []
html = ""
nodes.each do |node|
if stack.empty?
html << start_tag(node)
stack.push(node)
next
end
if stack.last.lft < node.lft && node.lft < stack.last.rgt