Skip to content

Instantly share code, notes, and snippets.

function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@phawxby
phawxby / gist:89ec7a839bb6e08503799d8e503008a8
Created January 14, 2017 23:15
DHT11 Temperature Humidity Sensor + Arduino
/* DHT11 temperature and humidity sensor
* Project tutorial url: http://kookye.com/2015/03/21/dht11-temperature-and-humidity-sensor/
* Circuit diagram here: http://osoyoo.com/2015/03/21/dht11-temperature-and-humidity-sensor/
*
* Sample code: http://kookye.com/wp-content/uploads/samplecode/dht11.txt
* Rewritten by https://github.com/phawxby
*/
int dht11pin = A0;
void setup(){
@phawxby
phawxby / clean_locales_source.sql
Created May 2, 2017 17:14
Cleaning the locales_source table in Drupal 7
DELETE locales_source FROM locales_source LEFT JOIN locales_target lt USING ( lid ) WHERE lt.lid IS NULL
@phawxby
phawxby / gulpfile.js
Created May 21, 2017 16:30
Hexo integrated into a Gulp pipeline
'use strict';
// Based on https://gist.github.com/zhoujiealex/4d926889b02b85d4d8d73f036ef728eb
let Promise = require('bluebird');
let gulp = require('gulp');
let cssnano = require('gulp-cssnano');
let uglify = require('gulp-uglify');
let htmlmin = require('gulp-htmlmin');
let htmlclean = require('gulp-htmlclean');
let imagemin = require('gulp-imagemin');
#!/bin/bash
keep=20
num=0
for t in `git tag -l --sort=-taggerdate`
do
if [ $num > $keep ] then
git tag -d $t