Skip to content

Instantly share code, notes, and snippets.

View dpsk's full-sized avatar
🏠
Working from home

Mikhail Nikalyukin dpsk

🏠
Working from home
View GitHub Profile
<script type="text/javascript">
function clean(id) {
setTimeout('clean2("'+id+'")', 1)
}
function clean2(id) {
el=document.getElementById(id)
var savedSel = rangy.saveSelection();
el.innerHTML = el.innerHTML.replace(/(<([^>]+)>)/ig,"");
@dpsk
dpsk / cartographer.rb
Created April 25, 2011 12:27
cartographer
def home
@map = Cartographer::Gmap.new( 'map_canvas' ) # this is 11 line
@map.zoom = :bound
@icon = Cartographer::Gicon.new()
@map.icons << @icon
marker1 = Cartographer::Gmarker.new(:name=> "taj_mahal", :marker_type => "Building",
:position => [27.173006,78.042086],
:info_window_url => "/url_for_info_content", :icon => @icon)
marker2 = Cartographer::Gmarker.new(:name=> "raj_bhawan", :marker_type => "Building",
:position => [28.614309,77.201353],
var center = #{Geocoder.coordinates(request.location.country + ',' + request.location.city)}
console.log(center)
#production mode on local machine
var center = [50.45, 30.5233333]
#on heroku
var center = 50.4530.5233333
Регион Производитель
Наименование
Крепость Емкость
Тип марки Серия
Начальный номер Конечный номер
------ ----------------------------------------------------------------
-----------------------------------------------------------------------
@dpsk
dpsk / gist:993862
Created May 26, 2011 19:27 — forked from ndbroadbent/gist:971255
Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
#!/bin/bash
#
# => $ sudo apt-get install -y --force-yes curl; sudo su - -c "bash < <(curl -sL http://is.gd/..........)"
#
# Deploy Fat Free CRM (rails3 branch) to a freshly installed Ubuntu machine.
# --------------------------------------------------------------------------
#
# Steps:
#
# *) Install required packages (git, postgresql, etc.)
@dpsk
dpsk / gist:1042653
Created June 23, 2011 14:37
nginx error
[ pid=2094 thr=3065830256 file=ext/nginx/HelperAgent.cpp:584 time=2011-06-23 10:35:04.287 ]: Uncaught exception in PassengerServer client thread:
exception: An error occured while sending the request body to the request handler: Connection reset by peer (104)
backtrace:
in 'virtual void Passenger::Session::sendBodyBlock(const char*, unsigned int)' (Session.h:198)
in 'void Client::sendRequestBody(Passenger::SessionPtr&, Passenger::FileDescriptor&, const std::string&, long unsigned int)' (HelperAgent.cpp:295)
in 'void Client::handleRequest(Passenger::FileDescriptor&)' (HelperAgent.cpp:510)
in 'void Client::threadMain()' (HelperAgent.cpp:603)
2011/06/23 10:35:04 [error] 2141#0: *73 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 94.76.87.48, serve$
module IntegrationSpecHelper
def login_with_oauth(service = :facebook)
visit "/auth/#{service}"
end
end
============================================================================
RSpec.configure do |config|
config.include IntegrationSpecHelper, :type => :request
@dpsk
dpsk / jQuery HTML5 placeholder fix.js
Created September 7, 2011 12:55 — forked from hagenburger/jQuery HTML5 placeholder fix.js
placeholder support for old browsers
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
@dpsk
dpsk / voting.rb
Created September 23, 2011 08:25
total_peoples = 0
puts "how much groups?"
groups = gets.chomp.to_i
majority_of_each_group = Array.new
groups.times do
puts "how much people in group?"
peoples = gets.chomp.to_i
majority_of_each_group << peoples/2 + 1
end
@dpsk
dpsk / rspec-syntax-cheat-sheet.rb
Created October 22, 2011 08:28 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")