Skip to content

Instantly share code, notes, and snippets.

View leemour's full-sized avatar

Viacheslav Ptsarev leemour

View GitHub Profile

Rich Text Editing

External Links

  • WYSIWYG HTML
    • TinyMCE
      • looks like bootstrap
      • license: LGPL
      • integrates with Plupload for file uploading (PHP only)
  • integrates with MoxieManager for file management (PHP only)
{
"color_scheme": "Packages/User/Railscasts.tmTheme",
"font_size": 12,
"tab_size": 2,
"translate_tabs_to_spaces": false,
@leemour
leemour / recreate_versions.rb
Last active December 19, 2015 00:09
Pass a file to Rails Console. Recreate versons of images with Carrierwave
# bundle exec rails runner "eval(File.read 'lib/scripts/recreate_versions.rb')"
Product.all.each do |p|
%w(photo1 photo2 photo3 photo4 photo5).map(&:to_sym).each do |photo|
p.send(photo).recreate_versions! if p.read_attribute(photo).present?
end
end
function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}
@leemour
leemour / Padrino.sh
Created June 28, 2013 21:34
Padrino generate project
padrino g project padrino_test -d activerecord -t cucumber -s jquery -e haml -c sass -m mocha
@leemour
leemour / Compass
Last active December 19, 2015 03:18
Compass with Sass without Rails. Gem 'compass' and gem 'bootstrap-sass'
# compass create --syntax sass --sass-dir "app/assets/stylesheets" --css-dir "public/stylesheets" --javascripts-dir "app/assets/javascripts" --images-dir "public/images"
compass create -r bootstrap-sass --using bootstrap --syntax sass --sass-dir "app/assets/stylesheets" --css-dir "public/stylesheets" --javascripts-dir "app/assets/javascripts" --images-dir "public/images"
# compass create compass-test -r bootstrap-sass --using bootstrap --syntax sass
# Result:
Congratulations! Your compass project has been created.
You may now add and edit sass stylesheets in the sass subdirectory of your project.
@leemour
leemour / Compass detection
Created June 29, 2013 20:19
Compass detection
Compass vs. SASS project detection
LiveReload detects a project as a Compass one if one of the following conditions hold true:
there is a file config/compass.rb, .compass/config.rb, config/compass.config, src/config.rb or config.rb somewhere in your project which contains a literal string compass plugins or preferred_syntax = : inside
there is an SCSS/SASS file that imports compass* or *ZURB-foundation*
If that does not work for your project, please contact us and we'll fix it.
@leemour
leemour / routes.rb
Created July 3, 2013 09:25 — forked from araslanov-e/gist:5895283
Routing constraint
# app/constraints/photo_constraint.rb
class PhotoConstraint
def initialize
@types = Photo::TYPES
end
def self.matches?(request)
@types.include?(request.path_parameters[:type])
end
end