Skip to content

Instantly share code, notes, and snippets.

@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@jpalala
jpalala / how-to-setup-mac-elasticsearch.md
Created September 11, 2015 08:28
setting up elasticsearch on your mac with brew

Install va homebrew

If you don't have homebrew installed - get homebrew here

Then run: brew install elasticsearch

Configuration

Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.

if (!Function.prototype.bind) {
Function.prototype.bind = function bind(thisValue){
var func = this;
return function() {
return func.apply(thisValue, arguments);
}
}
}
@plaindocs
plaindocs / gist:f52355ee7d10327ba839
Last active September 5, 2019 05:22
PDF from markdown

Dependencies

Instructions are for Ubuntu ish:

sudo apt-get install -y python-dev python-pip python-lxml libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
sudo pip install WeasyPrint
sudo pip install markdown

For other systems check

@tef
tef / sort.py
Last active December 25, 2015 11:19 — forked from ntlk/sort.py
from sys import stdin, stdout
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-r', action='store_const', const=True, required=False, default=False)
args = parser.parse_args()
stdout.writelines(sorted(stdin.readlines(), reverse = args.r))
@brianloveswords
brianloveswords / eff-you-region-lock.md
Last active December 22, 2015 15:08
Defeating region lock

Prerequisites

  • Somewhat modern version of OpenSSH
  • Server you have SSH access to in the region you want to stream from.

Bummed about region lock? Start up your terminal and do this:

$ ssh -N -D 9999 yourserver.com
@tmcw
tmcw / index.html
Created January 3, 2013 17:05
d3.keybinding
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font:12px/20px 'Helvetica';
}
textarea, input {
width:100%;
height:20px;
margin:0;
"it's also not served over SSL, so you know, LOLZ"
"sslols"
"Secure Socket Laughters"
"It's for in jokes, so you can really make sure that nobody else gets it"
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@mjtko
mjtko / activesupport_time_calculations_of_hour-monkey-patch.rb
Created May 4, 2012 14:40
Add beginning_of_hour and end_of_hour to Time and DateTime
require 'active_support/core_ext/time/calculations'
unless Time.method_defined?(:beginning_of_hour)
class Time
# Returns a new Time representing the start of the hour (x:00)
def beginning_of_hour
change(:min => 0)
end
alias :at_beginning_of_hour :beginning_of_hour