Skip to content

Instantly share code, notes, and snippets.

View banesto's full-sized avatar

Ernests Kečko banesto

View GitHub Profile
// v1:
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) {
return parts.pop().split(";").shift();
} else {
return null;
}
<img src="http://upload.wikimedia.org/wikipedia/zh/3/34/Lenna.jpg " alt="Lena Söderberg full color" title="Lena Söderberg full color" style="float:left" />
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="300" height="300">
<filter id="greyscale">
<feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0
0.3333 0.3333 0.3333 0 0
0.3333 0.3333 0.3333 0 0
# Usage:
# cat <environment>.log | grep Load | grep SELECT | ruby filter.rb
MAX_TIME = 300.0
h = {}
STDIN.read.split("\n").each do |line|
list = line.split(' ')
time = list[2].scan(/\((.*)\./).flatten[0].to_f
var $button = $(button),
target = $button.data('target'),
$parent = $('.pollWrapped');
// simultanious action
$(target).stop(false, false).toggleClass('open').slideToggle(100).siblings().removeClass('open').slideUp(100);
var action = ($(target).parent().find('.open').length) ? 'addClass' : 'removeClass';
$parent[action]('showUpload');
@banesto
banesto / gist:c6d781671eb07f4cdde4
Created November 11, 2015 15:30
any? vs include?
require 'benchmark'
iterations = 100_000
Benchmark.bm do |bm|
bm.report do
iterations.times do
"a,b,c,d".split(',').any? { |letter| letter == 'd' }
end
end
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle; }
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;