Skip to content

Instantly share code, notes, and snippets.

View mojidabckuu's full-sized avatar

Vlad Gorbenko mojidabckuu

  • Donetsk, Ukraine
View GitHub Profile
@mojidabckuu
mojidabckuu / [1] main.js
Created May 20, 2018 12:28 — forked from hfalucas/[1] main.js
[Vue.js] Authentication and Authorization
/**
* Think of this "main.js" file as your application bootstrap.
*/
import Vue from 'vue'
import Resource from 'vue-resource'
import VueRouter from 'vue-router'
import routes from './routes'
import middleware from './middleware'
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
protocol ViewDelegate {
var contentDelegate: AnyObject? { get set }
var contentDataSource: AnyObject? { get set }
public typealias JSONObject = [String: AnyObject]
public typealias JSONArray = [String: AnyObject]
public protocol MetaRecord {}
public extension MetaRecord {
public final static var modelName: String {
let reflect = _reflect(self)
var className = "\(reflect.summary)"
if let typeRange = className.rangeOfString(".Type") {
className.replaceRange(typeRange, with: "")
public extension String {
public var pluralized: String { return StringInflector.sharedInstance.pluralize(self) }
public var singularized: String { return StringInflector.sharedInstance.singularize(self) }
}
public class StringInflector {
public struct Rule {
public enum Form {
case Singular
case Plural
@mojidabckuu
mojidabckuu / 1 app-models-session.rb
Created April 4, 2016 13:38 — forked from KieranP/1 app-models-session.rb
A Ruby on Rails implementation of a Database and Cookie hybrid session storage for Devise that supports session revocation and storage of session ip and user agent for security (similar to Github)
# A user session class, a simplified mix of the following code samples:
# * https://github.com/blog/1661-modeling-your-app-s-user-session
# * http://www.jonathanleighton.com/articles/2013/revocable-sessions-with-devise/
class Session < ActiveRecord::Base
# Uncomment if you use Hobo Fields, else add these yourself
# fields do
# session_id :string, :index => true, :unique => true
# accessed_at :datetime
# user_ip :string