Skip to content

Instantly share code, notes, and snippets.

View dan1d's full-sized avatar

Daniel Alejandro Dominguez Diaz dan1d

View GitHub Profile
# config/initializer/paperclip.rb
if Rails.env.production?
Paperclip::Attachment.default_options[:storage] = :s3
Paperclip::Attachment.default_options[:s3_credentials] = {
access_key_id: ENV["ACCSES_KEY_ID"],
secret_access_key: ENV['ACCSES_SECRET_KEY'],
bucket: ENV['BUCKET']
}
Paperclip::Attachment.default_options[:s3_host_alias] = "images.kole.com"
end
// JPLAYER
$(document).ready(function() {
$(document).pjax('a',{
container: '[data-pjax-container]',
timeout: 5000
})
$('form.navbar-search').submit(function(event) {
$.pjax.submit(event, {
container: '[data-pjax-container]}',
@dan1d
dan1d / gist:5247826
Created March 26, 2013 18:22
robar musica
require 'open-uri'
require "logger"
require 'json'
class UpdatePage
URL = 'http://www.setbeat.com'
REGEX = /playGo.addQueue\((\[{.*\}\])\)/
attr_accessor :urls, :artista
en el modelo
def self.build_survey(current_user)
@survey = current_user.surveys.build
end
y en el controller lo llamas
@survey = Survey.build_survey(current_user)
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
if Rails.env.production?
ActionMailer::Base.smtp_settings = {
user_name: "username",
password: "password",
domain: "kole.herokuapp.com",
address: "smtp.sendgrid.net",
port: 587,
authentication: :plain,
enable_starttls_auto: true
}
@dan1d
dan1d / gist:5685026
Created May 31, 2013 13:37
ActiveRecord without rails.
require "active_record"
require "sqlite3"
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => 'ejemplo',
:host => 'localhost')
ActiveRecord::Schema.define(:version => 0) do
gem 'jquery-fileupload-rails', '0.4.1'
# Formulario
listen_for_file_uploads = ->
$("#form-fileupload").fileupload
dataType: "json"
dropZone: $('#dropzone') # Div del dropzone
add: (e,data) ->
data.context = $('#hide_ajax_preloader').fadeIn() # Carga una gif hasta que termine el upload
= form_tag '/user_favorites', class: 'hidden' do
= hidden_field_tag :freelancer_id, freelancer.id
= submit_tag t('freelancer.search.result.mark_favorite')
ActiveAdmin.register Article do
filter :site
index do
column ("Site") { |article| article.site.name }
column ("Author"), sortable: :author do |article|
article.author
end
column ("Title"), sortable: :title do |article|