- Indent using 2 spaces
- Use single quotes, unless you are writing JSON
- Declare one variable per var statement
- Variables and properties should use lower camel case capitalization
- Class names should be capitalized using upper camel case
- Constants should be declared as regular variables or static class properties, using all uppercase letters
- Use the triple equality operator
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
!function($, wysi) { | |
"use strict"; | |
var tpl = { | |
"font-styles": function(locale, options) { | |
var size = (options && options.size) ? ' btn-'+options.size : ''; | |
return "<li class='dropdown'>" + | |
"<a class='btn btn-default dropdown-toggle" + size + "' data-toggle='dropdown' href='#' title='" + locale.font_styles.title + "'>" + | |
"<i class='glyphicon glyphicon-font'></i> <span class='current-font'>" + locale.font_styles.normal + "</span> <b class='caret'></b>" + | |
"</a>" + |
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
Failures: | |
1) Admin::ColorPalettesController POST #create with NOT authenticated user should redirect to the login page | |
Failure/Error: post :create, params: { color_palette: valid_attributes } | |
ActionDispatch::IllegalStateError: | |
header already sent | |
# /home/dalpo/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.rc2/lib/action_dispatch/http/response.rb:44:in `[]=' | |
# /home/dalpo/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.rc2/lib/action_dispatch/http/response.rb:180:in `set_header' | |
# /home/dalpo/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0.rc2/lib/action_dispatch/http/response.rb:420:in `set_content_type' |
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/sh | |
# | |
# puma - this script starts and stops the puma daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Description \ | |
# goes here... | |
# processname: puma | |
# config: /etc/puma.conf | |
# pidfile: /home/stanislaw/apps/micro-apps/puma/puma.pid |
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
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match. | |
Instructions: | |
1. Set your Gnome theme as you would like it | |
2. Run with a command like "python wine_colors_from_gtk.py" | |
3. Restart any apps running in Wine. They should match the Gnome theme colors now. | |
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/ | |
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper |
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 compass/css3/transform | |
.blueimp-gallery | |
.video-js-box.video-content | |
+transform-style(preserve-3d) | |
.video-js.vjs-default-skin | |
+translate(-50%, -50%) | |
position: absolute | |
left: 50% |
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
module PdfHelper | |
def wicked_pdf_stylesheet_link_tag(*sources) | |
sources.collect { |source| | |
asset = Rails.application.assets.find_asset("#{source}.css") | |
if asset.nil? | |
raise "could not find asset for #{source}.css" | |
else | |
"<style type='text/css'>#{asset.body}</style>" | |
end | |
}.join("\n").gsub(/url\(['"](.+)['"]\)(.+)/,%[url("#{wicked_pdf_image_location("\1")}")\2]).html_safe |
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
module PolicyHelper | |
def can?(action, subject) | |
policy(subject).try "#{action}?" | |
end | |
def policy_helper_arguments(*args, &block) | |
object = args[0] | |
if block_given? |
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
module SimpleForm | |
module Inputs | |
class Base | |
private | |
def valid_validator?(validator) | |
# conditional validators are no surprise to us, so just check the action: | |
action_validator_match?(validator) | |
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
= simple_form_for @post, html: { class: 'form-horizontal' }, defaults: { wrapper: :horizontal_form } do |f| | |
= f.error_notification | |
.form-inputs | |
= f.input :first_name | |
= f.input :last_name | |
= f.input :email | |
.form-actions | |
= f.button :submit |
NewerOlder