Skip to content

Instantly share code, notes, and snippets.

@b1
b1 / please-stop-embedding-bootstrap-classes-in-your-html.md
Last active August 29, 2023 17:12
Please stop embedding Bootstrap classes in your HTML!

http://ruby.bvision.com/blog/please-stop-embedding-bootstrap-classes-in-your-html

Posted on Feb 29, 2012

A few months ago, Twitter released Bootstrap, a UI framework for websites that caused such an impression that it quickly become the most followed project on Github ded link.

Its popularity is due mostly to the fact that it allows developers with weak design skills such as myself to quickly create an application that looks at worst adequate, and at best, quite attractive. I'm a huge fan.

Bootstrap also appeals to developers because it's implemented in Less, a CSS preprocessor written in Javascript that you can run in your browser, allowing a comfortable developer workflow and compatibility with sites written in Ruby, Python, PHP, or any other technology you can make web applications with.

@b1
b1 / slugify.py
Created May 7, 2014 15:01
slugify
#!/bin/env python2
# encoding: utf-8
import re
try:
from unidecode import unidecode
except ImportError:
Exception("pip install unidecode")
var unique = function(array) {
return array.reduce(function(memo, elem) {
if (memo.indexOf(elem) < 0) memo.push(elem);
return memo;
}, []);
};
// Example
//
// var callback = function(error, data) {console.log('Done.', error, data);};
@b1
b1 / media_queries.html
Created September 24, 2013 09:55
Just test MQ
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
margin: 0;
}
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@b1
b1 / send.py
Created April 19, 2013 10:34
Basic script for sending excel over smtp
import smtplib, os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
def send_mail(send_from, send_to, subject="", text="", files=None, server='smtp.google.ru'):
if files == None:
files = []
@b1
b1 / mediana.py
Last active December 15, 2015 15:49
mediana 50
#!/usr/bin/python
# coding: utf-8
""" """
def mediana(_list=None):
"""
Медиана (50-й перцентиль, квантиль 0,5) — возможное значение признака, которое делит ранжированную совокупность
(вариационный ряд выборки) на две равные части: 50 % «нижних» единиц ряда данных будут иметь значение признака
не больше, чем медиана, а "верхние" 50 % — значения признака не меньше, чем медиана.
@b1
b1 / google_sitemap_example.py
Last active December 14, 2015 20:09
Test script. parse VS iterparse On google.com/sitemap.xml
#!/usr/bin/python
# coding: utf-8
""" Parsing xml file. Basic example """
from StringIO import StringIO
from datetime import datetime
from lxml import etree
import urllib2
print """
Test script.
@b1
b1 / countries.csv
Created March 7, 2013 18:34
ISO 3166-2 tab separated list contry codes and country names
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Code Country name Year ccTLD ISO 3166-2 Notes
AD Andorra 1974 .ad ISO 3166-2:AD
AE United Arab Emirates 1974 .ae ISO 3166-2:AE
AF Afghanistan 1974 .af ISO 3166-2:AF
AG Antigua and Barbuda 1974 .ag ISO 3166-2:AG
AI Anguilla 1983 .ai ISO 3166-2:AI AI previously represented French Afar and Issas
AL Albania 1974 .al ISO 3166-2:AL
AM Armenia 1992 .am ISO 3166-2:AM
AO Angola 1974 .ao ISO 3166-2:AO
AQ Antarctica 1974 .aq ISO 3166-2:AQ Covers the territories south of 60° south latitude Code taken from name in French: Antarctique
import sys
import time
for i in xrange(100):
sys.stdout.flush()
time.sleep(0.5)
sys.stdout.write('\r' + str(i))