Skip to content

Instantly share code, notes, and snippets.

View bondarolik's full-sized avatar
🖥️
Coding now

V. Bruk bondarolik

🖥️
Coding now
View GitHub Profile
require 'digest/sha1'
class Invite < ActiveRecord::Base
validates_presence_of :email, :on => :save, :message => "can't be blank"
validates_uniqueness_of :email, :on => :save, :message => "is already registered"
named_scope :unsent_invitations, :conditions => {:redeemed_at => nil, :invite_code => nil}
def invited?
@eddanger
eddanger / basecamp2github.rb
Created December 8, 2011 05:23 — forked from chip/basecamp2github.rb
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
GITHUB_USERNAME = '__GITHUB_USERNAME__'
GITHUB_PASSWORD = '__GITHUB_PASSWORD__'
GITHUB_ORG = '__GITHUB_ORG__'
GITHUB_REPO = '__GITHUB_REPO__'
@postpostmodern
postpostmodern / rails_bootstrap_delete_confirmation_modal.md
Created February 19, 2012 07:38 — forked from trey/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')
@robertmarsal
robertmarsal / README.md
Last active March 20, 2022 02:26 — forked from mtowers/README.md
Google Analytics Real Time Visitors Widget for Dashing with OAuth2 Authentication
@braidn
braidn / paperclip.rb
Last active August 29, 2015 14:06
Paperclip Initializer
if ENV['USE_S3'] == 'true'
Paperclip::Attachment.default_options[:storage] = :fog
Paperclip::Attachment.default_options[:fog_credentials] = { provider: "AWS", aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] }
Paperclip::Attachment.default_options[:fog_directory] = ENV['FOG_BUCKET']
Paperclip::Attachment.default_options[:path] = '/app/public/assets/products/:id/:style/:basename.:extension'
Paperclip::Attachment.default_options[:fog_host] = ENV['S3_HOST_ALIAS']
Paperclip::Attachment.default_options[:url] = ':s3_alias_url'
Spree::Image.attachment_definitions[:attachment][:path] = 'public/assets/products/:id/:style/:basename.:extension'
else
Paperclip::Attachment.default_options[:storage] = :fog
@beshkenadze
beshkenadze / Ruby_finance_testcase.md
Created September 25, 2015 15:03
Тестовое задание для Ruby-разработчика

Задание

Реализовать на Ruby с использованием Rails приложение со следующим функционалом:

  1. Регистрация / авторизация пользователей.
  2. Создание портфеля акций (5-6 акций достаточно) для пользователя: стандартный CRUD.
  3. Данные должны скачиваться с Yahoo Finance.
  4. Сделать вывод графика "стоимость портфеля от времени" за 2 последних года по выбранным в п.2 акциям.

Требования

@gokulkrishh
gokulkrishh / media-query.css
Last active June 28, 2024 09:07
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
sudo npm uninstall npm -g
brew uninstall node

Then

sudo rm -rf /usr/local/lib/dtrace/node.d /usr/local/lib/node_modules /usr/local/bin/npm /usr/local/bin/nodemon /usr/local/bin/node /usr/local/include/node ~/.npm* ~/.node* /usr/local/share/man/*/node* /usr/local/share/man/*/npm*
@artanikin
artanikin / rubocop_pre_commit_hook
Created August 30, 2016 13:04 — forked from palkan/rubocop_pre_commit_hook
Rubocop pre-commit hook
#!/usr/bin/env ruby
ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze
changed_files = `git status --porcelain`.split(/\n/)
unstaged_files = `git ls-files -m`.split(/\n/)
changed_files = changed_files.select { |f| f =~ ADDED_OR_MODIFIED }
changed_files = changed_files.map { |f| f.split(" ")[1] }
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers