Skip to content

Instantly share code, notes, and snippets.

View over's full-sized avatar

Mikhail Tabunov over

View GitHub Profile
{
"inbox":{
"threads":[
{
"thread_id":"340282366841710300949128125765691413885",
"users":[
{
"pk":4041105442,
"username":"aleksei_kosorotov",
"full_name":"Aleksei Kosorotov",
@over
over / gist:7e52d630332e4bfca4a40d5b6d06428d
Created September 16, 2016 15:03
activeadmin example
# app/admin/company.rb
ActiveAdmin.register Company do
config.batch_actions = false
menu priority: 2
permit_params :name, :logo, :default_coupon_image, :stores_attributes => [:sector_id, :name]
actions :all, except: [:destroy]
index do
{"host":"cdn1.akamai.coub.com","hasExternalSound":false,"video_loading_time":1771,"session_id":"fp_session_1403691397031_865_coub_ahta_embed_type_fb","playerType":"fb","type":"fp_video_loaded","hasAutoplay":"true","countryCode":"CZ","coubId":"ahta","ip":"95.47.122.231"}
json={"file":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_file/9e2edf76bcc/4058f8be5e3be239d81d1/1367275833_downoad20130430-9584-fmsdgb.mp4","compiled_flv":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_file/9e2edf76bcc/4058f8be5e3be239d81d1/flv_med_size_1367275833_med.flv","flv_normal_size":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_file/9e2edf76bcc/4058f8be5e3be239d81d1/flv_med_size_1367275833_med.flv","mp4_normal_size":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_file/9e2edf76bcc/4058f8be5e3be239d81d1/mp4_med_size_1367275833_med.mp4","mp4_ipad_version":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_file/9e2edf76bcc/4058f8be5e3be239d81d1/ipad_1367275833_ipad.mp4","height":360,"width":640,"image":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_timeline_pic/9e2edf76bcc/4058f8be5e3be239d81d1/1367275833_downoad20130430-9584-y3vndd.jpg","timeline_pic":"http://cdn-staging0.turbobytes.coub.com/coub/simple/cw_timeline_pic/9e2edf76bcc/4058f8be5e3be239d81d1
-- staging --
HTTP/1.1 401 Unauthorized
Server: nginx/0.7.64
Date: Tue, 03 May 2011 12:29:02 GMT
Content-Type: application/xml; charset=utf-8
Connection: keep-alive
Status: 401 Unauthorized
WWW-Authenticate: Basic realm="Web Password"
X-Runtime: 5
Cache-Control: no-cache
# Получение коментов от фейсбука происходит через FQL, табличка comments_info
# Нужен гем facebooker, у меня для третьих рельсов:
gem 'facebooker', :git => "git://github.com/joren/facebooker.git", :branch => "rails3"
# Делаете модуль, в котором хранятся все настройки:
module Facebook
CONFIG = {
:app_id => "123123",
:api_key => "123123",
:app_secret => "123123"
<script type='text/javascript>
$(function() {
// Для фейсбука
$("#facebook-login-button a").trigger("click")
// Для вконтакте
$('#login_button').trigger("click")
})
</script>
//= require <jquery>
tm.behaviors.popup = $.klass({
initialize: function(popup) {
this.popup = popup;
},
onclick: $.delegate({
'.tm-popup-close': function() {
this.popup.hide();
},
'.tm-popup-submit': function() { this.popup.submit.apply(this); }
def image_tag(source, options = {})
path = File.join(Rails.root, "public", source.gsub(/\?[\d]+/, ''))
if File.exists?(path)
size = ImageSize.new(File.read(path)).get_size.join("x")
options.merge!(:size => size)
end
super(source, options)