This file contains hidden or 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
| def self.set_recipe_of_day(options = {}) | |
| day = options[:day] || Date.today | |
| force = options[:force] || false | |
| old_recipe = Recipe.recipe_of_day(day) | |
| new_recipe = calculate_recipe_of_day(day) | |
| if old_recipe == new_recipe | |
| if force | |
| new_recipe.save! | |
| new_recipe |
This file contains hidden or 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 Paperclip | |
| class Attachment | |
| class UploadedPath | |
| attr_reader :original_filename, :content_type, :size, :path | |
| def initialize(uploaded_file) | |
| @original_filename = uploaded_file["name"].downcase | |
| @content_type = uploaded_file["content_type"].to_s.strip | |
| @file_size = uploaded_file["size"].to_i | |
| @path = uploaded_file["path"] |
This file contains hidden or 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(smart_server). | |
| -export([start_link/0, init/0, long_request/1]). | |
| start_link() -> gen_server:start_link(?MODULE, [], []). | |
| long_request(Server) -> gen_server:call(Server, long_request). | |
| init() -> {ok, []}. | |
| handle_call(long_request, From, Buffer) -> |
This file contains hidden or 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
| #include "yuv_stream.h" | |
| enum bufferevent_filter_result has_enough_for_flv(struct evbuffer *src); | |
| static void errorcb(struct bufferevent *bev, short what, void *arg); | |
| void readcb(struct bufferevent *bev, void *arg); | |
| int open_cam(char *path); | |
| int open_output(char *path); | |
| flv_tag *read_decoder_config(struct bufferevent *bev); | |
| flv_tag *read_flv_tag(struct bufferevent *bev); |
This file contains hidden or 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
| AVCodecContext *new_software_decoder(flv_tag *decoder_config) | |
| { | |
| char decoder_name[] = "h264"; | |
| AVCodec *decoder = avcodec_find_decoder_by_name(decoder_name); | |
| // h264_vaapi, h264_vdpau | |
| if(!decoder) { | |
| fprintf(stderr, "Can't open decoder %s\r\n", decoder_name); | |
| return NULL; | |
| } |
This file contains hidden or 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
| class LegalPaper | |
| attr_reader :docx_path | |
| def initialize(docx_path) | |
| @docx_path = docx_path | |
| @path = Dir.mktmpdir | |
| end | |
| def process(data) | |
| FileUtils.mkdir_p("#{@path}/legal_paper") |
This file contains hidden or 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
| class Page | |
| def self.repo | |
| @repo ||= Grit::Repo.new(Erlyhub.doc_path) | |
| end | |
| def self.lookup_path(path, lang = nil) | |
| dirname = File.dirname(path) | |
| dirname = nil if dirname == "." | |
| tree = dirname ? (repo.tree / dirname) : repo.tree |
This file contains hidden or 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 ApplicationHelper | |
| def show_page(page) | |
| @name = page.is_a?(String) ? page : path.path | |
| page = Page.find(page, I18n.locale) if page.is_a?(String) | |
| raise ActiveRecord::RecordNotFound, "no page #{page}" unless page | |
| if !page.text_format? | |
| render :text => page.contents, :content_type => page.mime_type |
This file contains hidden or 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
| % ========================================================================================================== | |
| % MISULTIN - Example: Proxy requests to upstream | |
| % | |
| % ========================================================================================================== | |
| -module(misultin_proxy). | |
| -export([start/1, stop/0]). | |
| % start misultin http server | |
| start(Port) -> | |
| inets:start(), |
This file contains hidden or 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
| %% -*- mode: nitrogen -*- | |
| -module (index). | |
| -compile(export_all). | |
| -include_lib("nitrogen_core/include/wf.hrl"). | |
| -include("video.hrl"). | |
| main() -> #template { file="./site/templates/bare.html" }. | |
| title() -> "FFmpeg frontend". |