Skip to content

Instantly share code, notes, and snippets.

@Kadrian
Kadrian / scss-analysis.py
Last active August 29, 2015 14:11
SCSS Statistics Analysis
import sys
def analyzeFile(filename):
f = open(filename)
selectors, rules = [], []
for w in f.readlines():
w = w.strip()
if len(w) > 2:
if (w.startswith('.') or
w.startswith('/') or
@Kadrian
Kadrian / gist:83f8aacac8c8e118ce1c
Created January 9, 2015 05:45
Render the author's image
<% if not no_author_img %>
<img class="author" src="<%= author['author.image'].views['small'].url %>">
<% end %>
@Kadrian
Kadrian / get-dht11-data.py
Last active August 4, 2019 17:53
Get Temperature and Humidity from DHT11 module with Raspberry Pi and RPi.GPIO
import RPi.GPIO as GPIO
import time
import traceback
# Helper
def bin2dec(string_num):
return str(int(string_num, 2))
def setup_gpio(port):
GPIO.setmode(GPIO.BCM)
@Kadrian
Kadrian / actions.js
Created July 15, 2016 15:54
Redux async actions example
const defaultError = (type, error) => (
{
type,
error: true,
payload: {
message: error
},
}
);
// Trying to find the best solution to the following problem:
//
// Display a large number with a small space in between steps of thousand.
// Thus => Convert a number to an array of max. three digits
//
// E.g.
// Input: 10 Output: [10]
// Input: 1234 Output: [1, 234]
// Input: 24521280 Output: [23, 521, 280]
@Kadrian
Kadrian / material-green.css
Created March 24, 2017 08:18
Copy of material.css to host it where https is working
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png
@Kadrian
Kadrian / buy-coins.js
Last active September 13, 2017 19:39
Buy BTC / ETH / XRP automatically
// -----------
//
// ## How to use:
//
// 1) Install node 8
//
// 2) Install dependencies:
// `npm install crypto request`
//
// 3) Get a Bitstamp account, API key and tweak viariables below