Skip to content

Instantly share code, notes, and snippets.

View milushov's full-sized avatar
😏
crafting new bugs

roma milushov

😏
crafting new bugs
View GitHub Profile
@milushov
milushov / sadfasdf
Created September 17, 2011 19:14
asdfsdf
asdfasdfasdfsadfsadf
@milushov
milushov / Gemfile
Created February 29, 2012 04:40
123
source 'https://rubygems.org'
gem 'rails', '3.2.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
@milushov
milushov / gist:2908003
Created June 11, 2012 01:24
http://vk.com/audio total duration of searched tracks
var total_time = function() {
var durs_sourse = [], total = 0;
$('.duration').each(function(i,v){ durs_sourse.push( $(v).html() ); })
for(v in durs_sourse) {
total += parseInt(durs_sourse[v].split(':')[0]*60) + parseInt(durs_sourse[v].split(':')[1])
}
return 'всего ' + (total/(60*60)).toFixed() + ' час. ' + (total%(60)) + ' мин.';
}
counter = 0;
$('#desc-show p').each( function(i,val){
var str = $(val).text();
str = str.split('-')[1];
if(typeof(str) == 'string') {
str = str.split(' ')[1];
counter += parseInt( str );
console.log(str);
}
});
@milushov
milushov / test.js
Created October 10, 2012 03:08
js inheritance
var extend = function(child, parent) {
for (var key in parent) {
if(parent.hasOwnProperty(key)) child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
@milushov
milushov / sublime.json
Last active October 11, 2015 22:48
st2 settings
{
"caret_style": "smooth",
"detect_slow_plugins": false,
"draw_centered": true,
"font_size": 12,
"ignored_packages":
[
],
"tab_size": 2,
"vintage_ctrl_keys": true,
this.load = function(callback, act) {
if(act || __images.length === 0) callback.call();
var cover = document.createElement('div'),
counter = 0;
cover.id = 'cover';
cover.style.width = wwh()[0]+'px';
cover.style.height = wwh()[1]+'px';
cover.innerHTML = ' \
setInterval(function() {
d0 = app.divers[0];
d1 = app.divers[1];
d2 = app.divers[2];
console.log(d0, d1, d2);
console.log(d0.air.toFixed(2)+' ', d1.air.toFixed(2)+' ', d2.air.toFixed(2));
}, 500);
class Dashboard::AttachmentsController < ApplicationController
before_filter :prepare
FORMS = [Question]# Ask Application Feedback Occupation]
def create
@attachment = Attachment.new params[:attachment]
unless @access_error
@attachment.attachable_id = @temp_attachable_id
class Attachment < ActiveRecord::Base
before_create :default_name
attr_accessible :file, :attachable_id
mount_uploader :file, FileUploader
belongs_to :attachable, polymorphic: true
def default_name