Skip to content

Instantly share code, notes, and snippets.

View padde's full-sized avatar

Patrick Oscity padde

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Magento" targetNamespace="urn:Magento">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="FixedArray">
<complexContent>
<restriction base="soapenc:Array">
@padde
padde / benchmark.rb
Last active December 16, 2015 12:19
require 'fruity'
compare do
rubylovely {
a3 = [["a", "b"], ["a","c"], ["b","c"], ["b", "a"], ["c","b"],["b", "a"]]
a3.each {|x| a3.delete(x.reverse) if a3.include? x.reverse}
}
padde {
a3 = [["a", "b"], ["a","c"], ["b","c"], ["b", "a"], ["c","b"],["b", "a"]]
<div id="image" class="image textbox ">
<div class="">
<img src="img.jpg" alt="" original-title="">
</div>
</div>
@padde
padde / gist:5106440
Created March 7, 2013 08:26
delimitMate Report
delimitMate Report
==================
* Options: ( ) default, (g) global, (b) buffer
( ) delimitMate_apostrophes = ''
( ) delimitMate_autoclose = 1
( ) delimitMate_balance_matchpairs = 0
( ) delimitMate_eol_marker = ''
( ) delimitMate_excluded_ft = ''
@padde
padde / enumerable.rb
Last active December 14, 2015 14:08
Enumerable#each_with_position (with other? and other{ ... })
module Enumerable
class Position
def initialize ary
@pos = 1
@max = ary.size
@cache = Hash.new
@warn_other = false
end
def advance
@padde
padde / array.rb
Last active December 14, 2015 14:08
Array#each_with_position (cached) Useful if you call the pos methods often.
class Array
class Position
def initialize ary
@pos = 1
@max = ary.size
@cache = Hash.new
end
def advance
@pos += 1
@padde
padde / array.rb
Last active December 14, 2015 13:59
Array#each_with_position
class Array
class Position
attr_accessor :idx, :max
def initialize arr
self.max = arr.size
end
def pos
idx + 1
@padde
padde / array.rb
Last active December 14, 2015 13:59
Monkeypatch for Array with each DSL that shows if current element is first, last, etc.
class Array
class EachDSL
attr_accessor :idx, :max
def initialize arr
self.max = arr.size
end
def pos
idx + 1
@padde
padde / template.liquid
Created February 14, 2013 06:35
Basic Locomotive Template
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test</title>
{% seo %}
{% inline_editor %}
</head>
<body>
<nav id="main_menu">
@padde
padde / highlight.rb
Created January 27, 2013 16:21
Code highlight from stdin thingy
#!/usr/bin/env ruby
require 'securerandom'
require 'fileutils'
require 'coderay'
require 'coderay_bash'
require 'trollop'
opts = Trollop::options do
opt :language, "The language used to highlight the input", short: '-l', type: :string, default: nil