Skip to content

Instantly share code, notes, and snippets.

View vyorkin's full-sized avatar
❤️‍🔥

Vasiliy Yorkin vyorkin

❤️‍🔥
View GitHub Profile
app_name = "myApp"
app = angular.module "#{app_name}.controllers", []
class BaseController
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
@$inject = args
class @Base
constructor: (args...) ->
for key, index in @constructor.$inject
@[key] = args[index]
@inject: (args...) -> @$inject = _.union @$inject args
class @BaseCtrl extends @Base
constructor: (args...) ->
module APICommonHelpers
def access_denied!(message = 'Access denied')
error! message, 401
end
def bad_request!(message = 'Bad request')
error! message, 400
end
def forbidden_request!(message = 'Forbidden')
require 'active_support/core_ext/hash'
require 'capistrano/undev'
require 'capistrano-db-tasks'
require 'airbrake/capistrano3'
require './config/boot'
SSHKit.config.command_map[:rake] = 'bundle exec rake'
@vyorkin
vyorkin / gist:e2b9b1205634b9656ee0
Created October 19, 2014 21:54
basic makefile skeleton
CXX=clang++
FLAGS=-std=c++11 -stdlib=libc++
all:
clean:
rm -fr build/*
test:
$(CXX) $(FLAGS) src/test.cpp -o build/test.bin -Isrc/
@vyorkin
vyorkin / Guardfile
Created December 28, 2014 18:04
turbo Guardfile
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec feature)
## Uncomment to clear the screen before every task
# clearing :on
## Guard internally checks for changes in the Guardfile and exits.
@vyorkin
vyorkin / MskTimeZone
Last active August 29, 2015 14:12
some dikiy pizdets
class I18nTimeZone < ActiveSupport::TimeZone
class << self
def all
TZInfo::Timezone.all.map do |tzinfo|
utc_offset = tzinfo.current_period.utc_offset
create(tzinfo.name, utc_offset, tzinfo)
end
end
end
@vyorkin
vyorkin / gist:3e8a29f702a4ec7b8988
Created December 29, 2014 23:12
cap3 maintenance mode
namespace :maintenance do
desc "Maintenance start (edit config/maintenance.yml to provide parameters)"
task :start do
on roles(:web) do
upload! "config/maintenance.yml", "#{current_path}/tmp/maintenance.yml"
end
end
desc "Maintenance stop"
task :stop do
@vyorkin
vyorkin / designer.html
Created December 30, 2014 22:04
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
#define говно NULL
#define нихуя void
#define факт bool
#define хуёво false
#define пиздато true
#define цифра int
#define число float
#define базар char
#define ТамГде *
#define типа {