Skip to content

Instantly share code, notes, and snippets.

<div class="panel" id="live_check">
<div class="panel-heading text-center">
<h2>Контроль участия</h2>
</div>
<div class="panel-body">
<p class="question">Вы с нами в прямом эфире ?</p>
<%= link_to 'Да', '#', onclick: 'javascript:close_live_check(); return;', class: 'btn btn-info btn-block' %>
</div>
</div>
@raveman
raveman / gist:df48bc0e4e8cdbabf66b2deef5eb2212
Created August 10, 2021 17:00 — forked from stereodenis/gist:d5749a0f17b1b53b5963
social meta tags helper ruby on rails 4
def social_meta_tags
title = "#{(content_for?(:title) ? (strip_tags(content_for(:title)).html_safe + ' / ') : '')}#{t('project_title')}"
description = content_for?(:description) ? content_for(:description) : ''
image = if @doc.present?
image_url(@doc.cover_photo.cover.url)
elsif @main.present?
image_url(@main.cover_photo.cover.url)
else
''
end
@raveman
raveman / excel_dumper.rb
Created March 19, 2021 14:56 — forked from arkadiyk/excel_dumper.rb
Export data to Excel. Nicely formatted, with correct datatypes, text wrap for long fields.
class ExcelDumper
def initialize(array)
@data = array
end
def to_xls(options = {})
output = %{<?xml version="1.0" encoding="UTF-8"?>
<Workbook xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
@raveman
raveman / routes.rb
Created February 8, 2021 15:48 — forked from kryzhovnik/routes.rb
Интеграция Яндекс.Кассы с Rails
# config/routes.rb
YandexKassaIntegration::Application.routes.draw do
# ...
scope '/yandex_kassa' do
controller 'yandex_kassa', constraints: { subdomain: 'ssl' } do
post :check
post :aviso
get :success
get :fail
@raveman
raveman / ultimate_question.rb
Created October 28, 2019 09:59
ultimate question of life
x = [false, *(1..7), nil, 9]
.map(&:object_id)
.map { |i| i / 2 }
.select { |i| i % 2 }
.sum
.+(STDOUT.fileno)
@raveman
raveman / bootstrap4_breadcrumbs_builder.rb
Last active February 6, 2018 14:03 — forked from riyad/bootstrap_breadcrumbs_builder.rb
How to make breadcrumbs_on_rails render a Bootstrap 4 compatible breadcrumb navigation
# based on riyad's bootstrap breadcrumb builder https://gist.github.com/riyad/1933884
#
# The BootstrapBreadcrumbsBuilder is a Bootstrap compatible breadcrumb builder.
# It provides basic functionalities to render a breadcrumb navigation according to Bootstrap's conventions.
#
# BootstrapBreadcrumbsBuilder accepts a limited set of options:
# * separator: what should be displayed as a separator between elements
#
# You can use it with the :builder option on render_breadcrumbs:
# <%= render_breadcrumbs :builder => ::BootstrapBreadcrumbsBuilder, :separator => "&raquo;" %>
@raveman
raveman / nginx.conf
Created December 9, 2017 09:41 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@raveman
raveman / gist:94fd0e89ca98d00601d32eb0623df42c
Created May 23, 2016 18:58 — forked from ArchieGoodwin/gist:d07895ac1481d20af509ec08c93a6119
Shows message for given time in upper part of screen above all windows including status bar (swift)
func showMessage(message : String, delay : NSTimeInterval, color : UIColor, completion: boolClosure?)
{
dispatch_async(self.GlobalMainQueue)
{
guard let window = appDelegate.window else
{
completion!(result: false,error: nil)
return
}
#!/bin/sh
while [ 1 ]; do
ffmpeg -re -f concat -i ./$1 -c copy -f flv rtmp://ferry1.irsot.net/bhtvlive/live
done
#!/bin/sh
wget --content-disposition http://buy-home.tv/admin/reels/playlist
FILE=`wget --server-response -q -O - "http://buy-home.tv/admin/reels/playlist" 2>&1 |.
grep -i "Content-Disposition:" | tail -1 | awk 'match($0, /filename=(.+)/, f) { print f[1] }' | sed -e 's/^"//' -e 's/"$//'`
cd ./tmp
youtube-dl -a ../$FILE -f mp4 --skip-download