I hereby claim:
- I am joshualcoffee on github.
- I am jcoffee (https://keybase.io/jcoffee) on keybase.
- I have a public key whose fingerprint is CD80 91A1 EB6A 9C74 646D 41A0 FF4D 5558 FA6C 6316
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
export default (text) => text; |
module FormHelper | |
def bootstrap_errors_for(attr, form, &block ) | |
errors = form.errors[attr] | |
error_messages = errors.map{|error| content_tag(:span, error)} | |
content = block_given? ? capture(&block) : "".html_safe | |
noko_content = Nokogiri::HTML::DocumentFragment.parse(content) | |
noko_content.css('.form-group')[0]['class'] = "#{noko_content.css('.form-group')[0]['class']} has-error" if errors.present? | |
if error_messages.present? |
@today_tasks = @incomplete_tasks.where('scheduled_at < ?', Time.zone.now.end_of_day).paginate(per_page: 30, page: params[:today_tasks_page]) | |
@upcoming_tasks = @incomplete_tasks.where('scheduled_at > ?', Time.zone.now.end_of_day).paginate(per_page: 30, page: params[:upcoming_tasks_page]) | |
@past_tasks = @complete_tasks.paginate(per_page: 30, page: params[:past_tasks_page]).reorder('scheduled_at desc') | |
@job_tags = current_account.tags.where(tag_type: 'Job') | |
respond_to do |format| | |
format.html | |
format.js do | |
@param_name = params.keys.keep_if { |name| name =~ /_page/ }.first |
calculate_summary = ($el) -> | |
$cells = $("td", $el) | |
$cells.each (i, v) -> | |
val = parseInt($(this).text()) | |
int = if isNaN(val) then 0 else val | |
if !sums[i]? | |
sums[i] = 0 | |
sums[i] = sums[i] + int | |
return sums | |
$ -> |
$scope.buildPagination = () -> | |
c = $scope.current_page | |
padded = $scope.pagination_padding*2 | |
arr = [] | |
if c <= $scope.total_pages | |
min = c - $scope.pagination_padding | |
max = c + $scope.pagination_padding | |
show_next = true |
def scrape_images(url) | |
doc = Nokogiri::HTML(open(url)) | |
url = url.slice( /\A(http|https)(:\/\/){1}[a-z0-9\-\.]{1,}/i ) | |
images = [] | |
doc.css("img").each do |img| | |
img = img['src'] | |
if img =~ /\A\/.*/ | |
src = url + img | |
# Check for complete link |