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 get_triple(*args) | |
args.map{|i| i*3} | |
end |
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 ActiveAdminHelper | |
def admin_arbre_context | |
@admin_arbre_context ||= Arbre::Context.new(assigns, self) | |
end | |
def default_renderer | |
case controller.send(:resource_class).name | |
when "ActiveAdmin::Page" | |
"page" |
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
<link rel="import" href="../topeka-elements/theme.html"> | |
<link rel="import" href="../topeka-elements/topeka-resources.html"> | |
<link rel="import" href="../topeka-elements/topeka-categories.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
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
#= require active_admin/base | |
#= require chosen-jquery | |
#= require dataTables/jquery.dataTables | |
$.fn.dataTableExt.oApi.fnPagingInfo = (oSettings) -> | |
{ | |
'iStart': oSettings._iDisplayStart | |
'iEnd': oSettings.fnDisplayEnd() | |
'iLength': oSettings._iDisplayLength | |
'iTotal': oSettings.fnRecordsTotal() |
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
function ajax_delete_url(url, params, callback){ | |
$.ajax({ url: url, type: 'DELETE', data: params, success: callback }); | |
} | |
function ajax_get_url(url, params, callback){ | |
$.ajax({ url: url, type: 'GET', data: params, success: callback }); | |
} | |
function ajax_post_url(url, params, callback){ | |
$.ajax({ url: url, type: 'POST', data: params, success: callback }); |
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
#config/initializers/paperclip.rb | |
Paperclip::Attachment.default_options[:s3_host_name] = 's3-us-west-2.amazonaws.com' | |
Paperclip::Attachment.default_options[:url] = ':s3_domain_url' | |
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename.#{Time.now.to_i}' |
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
# Implement a Primes class with a class method first(n) | |
# that returns an array of the first n prime numbers. | |
class Primes | |
def self.first(total, primes=[2], n=2) | |
primes.count >= total ? primes : (eval ((2..n-1).map{|j| (n % j == 0) ? false : true}).join(" && ")) ? first(total, primes.push(n), n+1) : first(total, primes, n+1) | |
end | |
end |
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 list(names) | |
names.map{|i| i[:name]}.join(" ").gsub(/[ ]/, ', ').gsub(/(.*), /, '\1 & ') | |
end |
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 get_sum(n) | |
odd, even = 0, 0 | |
(1..n).map{|i| i % 2 == 0 ? even += i : odd += i } | |
puts "Suma de Pares : #{even} \nSuma de Impares : #{odd}" | |
end |
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 square(n, ext_char, int_char) | |
(0..n).map{|i| p (0..n).map{|j| ([0, n].to_a & [i, j]).any? ? ext_char : int_char }.join} | |
end |
OlderNewer