Skip to content

Instantly share code, notes, and snippets.

View connecticus's full-sized avatar

Ekaterina Belinska connecticus

View GitHub Profile
@khripunovpp
khripunovpp / yandex-map-with-list-groups-twise-depth-bootstrap-adaptive
Last active June 15, 2018 22:10
yandex-map-with-list-groups-twise-depth-bootstrap-adaptive
#map
width: 100%
height: 500px
+ ymaps
width: 100%
height: 500px
.list-group-item
.list-group
margin-top: 20px
.submenu
@maxivak
maxivak / Spree: Filter by brand.md
Last active March 16, 2021 01:31
Spree: Filter Products by properties

Fix 'scoped' error for Rails 4

error: undefined method 'scoped' solution:

# config/initializers/scoped.rb
class ActiveRecord::Base
  # do things the modern way and silence Rails 4 deprecation warnings
 def self.scoped(options=nil)

options ? where(nil).apply_finder_options(options, true) : where(nil)

@vdchristelle
vdchristelle / google_map_custom_icon.html
Last active June 7, 2016 09:58
Google map with custom icon + custom balloon Google Maps Custom markers info: https://developers.google.com/maps/tutorials/customizing/custom-markers Google MAPS API: https://developers.google.com/maps/documentation/javascript/reference#InfoWindow -------> ATTENTION: do not put this code in de document load part <---------------
// add this to your html page (e.g. in a block)
<div id="map_canvas">map_canvas</div>
@Matho
Matho / refinerycms_nginx_proxy_cache
Last active September 9, 2016 20:20
Refinery CMS - Nginx proxy_cache instead of Rack:Cache
Refinery CMS:
Caching images generated by Dragonfly with Nginx cache_proxy instead of Rack:Cache
Before:
Static image served by Nginx: 4409.40 req/sec (mean)
Dragonfly generated images from Rack:Cache: 286.66 req/sec (mean)
After:
Dragonfly generated images from Nginx proxy_cache: 4099 req/sec (mean)
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@yellowled
yellowled / ffmpeg-html5
Created December 6, 2011 19:39
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. Will probably convert this to a bash script later, but for the time being, here's some examples. Not sure there have actually sensible dimensions and bitrates for web video.
# webm
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm
# mp4
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4
# ogg (if you want to support older Firefox)
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend
@mikhailov
mikhailov / installation.sh
Created November 23, 2010 15:18
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz