Skip to content

Instantly share code, notes, and snippets.

View div's full-sized avatar

Igor Davydov div

  • Barcelona, Spain
View GitHub Profile
[
{:product_id=>15298, :new=>{:rack=>23, :shelf=>1}, :old=>{15298=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15295, :new=>{:rack=>23, :shelf=>1}, :old=>{15295=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15296, :new=>{:rack=>23, :shelf=>1}, :old=>{15296=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15294, :new=>{:rack=>23, :shelf=>1}, :old=>{15294=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15301, :new=>{:rack=>23, :shelf=>1}, :old=>{15301=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15302, :new=>{:rack=>23, :shelf=>1}, :old=>{15302=>{:rack=>13, :shelf=>4, :place=>nil}}},
{:product_id=>15303, :new=>{:rack=>23, :shelf=>1}, :old=>{15303=>{:rack=>13, :shelf=>2, :place=>nil}}},
{:product_id=>16075, :new=>{:rack=>25, :shelf=>2}, :old=>{16075=>{:rack=>27, :shelf=>4, :place=>nil}}},
{:product_id=>16070, :new=>{:rack=>25, :shelf=>2}, :old=>{16070=>{:rack=>27, :shelf=>4, :place=>nil}}},
@div
div / test.kml
Last active October 2, 2020 20:14
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document><name>kml-file with polygon for bird species range</name>
<description>Source various books and websites</description>
<Style id="rangecolourred">
<LineStyle><color>600000ff</color><width>0.1</width></LineStyle>
<PolyStyle><color>600000ff</color></PolyStyle>
</Style>
class PaymentsController < ApplicationController
def new
payment = order.payments.create!(amount: order.total)
response = Payture.init options
payment.update session_id: response[:session_id]
redirect_to payment.payture_url
end
end
class Payment < ActiveRecord::Base
class ApplicationController < ActionController::Base
before_filter :authenticate
private
def authenticate
login = authenticate_or_request_with_http_basic do |username, password|
username == ENV["USERNAME"] && Digest::SHA1.hexdigest(password) == ENV["PASSWORD_HASH"]
end
end
function AttachmentCtrl($scope, $location, $timeout, Docs) {
$(function() {
$('#detail-form-doc').fileupload({
dataType: 'json',
url: '/angular-ib/app/fileupload?id=' + $location.search().id,
add: function(e, data) {
$scope.$apply(function(scope) {
// Turn the FileList object into an Array
for (var i = 0; i < data.files.length; i++) {
$scope.project.files.push(data.files[i]);
function AttachmentCtrl($scope, $location, $timeout, Docs) {
$(function() {
$('#detail-form-doc').fileupload({
dataType: 'json',
url: '/angular-ib/app/fileupload?id=' + $location.search().id,
add: function(e, data) {
$scope.$apply(function(scope) {
// Turn the FileList object into an Array
for (var i = 0; i < data.files.length; i++) {
$scope.project.files.push(data.files[i]);
@div
div / db.rb
Created April 11, 2013 20:34
Sync db with prod/stage env
require 'erb'
Capistrano::Configuration.instance(:must_exist).load do
namespace :db do
task :backup_name, :roles => :db, :only => { :primary => true } do
now = Time.now
run "mkdir -p #{shared_path}/db_backups"
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-')
set :backup_file, "#{shared_path}/db_backups/#{environment_database}-snapshot-#{backup_time}.sql"
/* jqueryFileUpload-Plugin
https://github.com/blueimp/jQuery-File-Upload */
MYANGULARAPP.directive('myJqueryfileupload', function(){
return{
restrict:'E',
compile:function(el,attrs){
var compiler = this;
var elem = el;
// 2DO: serialize it from json?
function AttachmentCtrl($scope, $location, $timeout, Docs) {
$(function() {
$('#detail-form-doc').fileupload({
dataType: 'json',
url: '/angular-ib/app/fileupload?id=' + $location.search().id,
add: function(e, data) {
$scope.$apply(function(scope) {
// Turn the FileList object into an Array
for (var i = 0; i < data.files.length; i++) {
$scope.project.files.push(data.files[i]);
@div
div / 0-readme.md
Created October 3, 2012 09:49 — forked from sj26/0-readme.md
ruby-1.9.3-p327 cumulative performance patch.

Patched ruby 1.9.3-p327 for 30% faster rails boot + with support of utf-8 console input

What is?

This script installs a patched version of ruby 1.9.3-p327 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.