Skip to content

Instantly share code, notes, and snippets.

View mamantoha's full-sized avatar
🇺🇦
#StandWithUkraine

Anton Maminov mamantoha

🇺🇦
#StandWithUkraine
  • Ternopil, Ukraine
  • 10:21 (UTC +03:00)
View GitHub Profile
require 'oauth2'
require 'mechanize'
@client = OAuth2::Client.new(
'client_id',
'client_secret',
:site => 'https://api.vk.com/',
:token_url => '/oauth/token',
:authorize_url => '/oauth/authorize'
)
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'oauth2'
require 'json'
require 'haml'
CLIENT_SECRET = '***'
CLIENT_ID = '***'
/ Допускається будь-який варіант
h1 class=page_header_class = page_header
h1{class=page_header_class} = page_header
h1[class=page_header_class] = page_header
h1(class=page_header_class) = page_header
/ При використанні обгортки, атрибути можуть займати кілька рядків
h1( class=page_header_class
id="myid")= page_header
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'slim'
require 'warden'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new(STDOUT, :debug)
@mamantoha
mamantoha / app.rb
Created October 25, 2011 20:58
Warden integration with Sinatra and DataMapper - http://ruby-ua.blogspot.com/2011/10/user-datamapper-warden.html
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'slim'
require 'warden'
require 'dm-core'
require 'dm-migrations'
require 'dm-timestamps'
require 'dm-validations'
@mamantoha
mamantoha / app.rb
Created October 26, 2011 14:35
Warden integration with Sinatra and DataMapper(w/ BCryptHash) - http://ruby-ua.blogspot.com/2011/10/user-datamapper-bcrypthash-warden.html
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'slim'
require 'warden'
require 'dm-core'
require 'dm-migrations'
require 'dm-timestamps'
require 'dm-validations'
@mamantoha
mamantoha / models.rb
Created December 13, 2011 14:38
Models and associations
class Account
include DataMapper::Resource
property :id, Serial
property :name, String
#####
# 1 #
##### One-to-many-through
# Користувач є власником безлічі подій
@mamantoha
mamantoha / bootstrap_link_render.rb
Created February 13, 2012 18:59
Налаштування will_paginate для Bootstrap у Sinatra - http://ruby-ua.blogspot.com/2012/02/willpaginate-bootstrap-sinatra.html
@mamantoha
mamantoha / .vimrc
Created March 7, 2012 16:25
.vimrc
set nocompatible "don't need to keep compatibility with Vi
filetype plugin indent on "enable detection, plugins and indenting in one step
syntax on "Turn on syntax highlighting
set cursorline "underline the current line in the file
set cursorcolumn "highlight the current column. Visible in GUI mode only.
set fileencodings=utf-8,cp1251,cp866,koi8-u
# -*- encoding: utf-8 -*-
#http://en.wiktionary.org/wiki/Index:Chinese_radical
ua_cn = {
'а' => '开',
'б' => '石',
'в' => '阝',
'г' => '厂',
'ґ' => '广',