Skip to content

Instantly share code, notes, and snippets.

View h2non's full-sized avatar

Tom h2non

  • Dissident
  • Decentralized
View GitHub Profile
@h2non
h2non / wget_download.sh
Last active December 23, 2015 15:59
wget output simple parsing to show the download process
#!/bin/bash
download_status() {
if [ -f $1 ]; then
while : ; do
sleep 1
local speed=$(echo `cat $1 | grep -oh '\([0-9.]\+[%].*[0-9.][s|m|h|d]\)' | tail -1`)
echo -n "Downloading... $speed"
echo -n R | tr 'R' '\r'
#!/usr/bin/env node
/**
* A very basic Node.js Bower installer replacement for download private hosted components
* @version 0.1
* @license WTFPL
*
* Usage:
* node bower-private-install.js -u username -p password -f ../bower.json
*
* TODO:
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@mixin make-grid-columns($cols: $cols-all) {
// Common styles for all sizes of grid columns, widths 1-12
@debug #{$cols};
#{$cols} {
position: relative;
// Prevent columns from collapsing when empty
min-height: 1px;
// Inner gutter via padding
padding-left: ($grid-gutter-width / 2);
padding-right: ($grid-gutter-width / 2);
@h2non
h2non / component-layout.md
Last active December 29, 2015 13:29
Web Component general purpose organization layout structure
component
├── src
│   ├── scripts
│   │   ├── module.js
│   │   ├── services
│   │   │   └── cache.js
│   │   ├── directives
│   │   │   └── login.js
│ │ └── filters
@h2non
h2non / croak-project-example.md
Last active December 30, 2015 06:09
Croak example project structure

Croak example project structure and configuration scenario

$HOME
├── .croakrc
└── workspace
    ├── builder
    │   ├── tasks
    │   ├── node_modules
    │   ├── .jshintrc
@h2non
h2non / Makefile
Created December 15, 2013 16:46
Makefile for node projects. Requires semver package $ npm install semver --save-dev
LIB = $(SRC:src/%.js=lib/%.js)
build: $(LIB)
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
@h2non
h2non / styleguide.js
Last active December 31, 2015 12:19
styleguide absolute path issue fix
// origin source: https://github.com/indieisaconcept/grunt-styleguide/blob/master/tasks/styleguide.js#L221
styleguide.files = {
file: file,
src: files.length > 0 && files || grunt.file.exists(file.orig.src) && file.orig.src,
dest: file.dest
};
styleguide.files.base = (function () {
var base;
@h2non
h2non / ng-inject-table
Created December 21, 2013 13:01
Angular Injector support table
+----------------+----------+------------+-----------+---------+--------+----------+---------+-------+
| Can we inject? | Constant | Controller | Directive | Factory | Filter | Provider | Service | Value |
+----------------+----------+------------+-----------+---------+--------+----------+---------+-------+
| Constant | | | | | | | | |
| Controller | | | | | | | | |
| Directive | | | | | | | | |
| Factory | | | | | | | | |
| Filter | | | | | | | | |
| Provider | | | | | | | | |
| Service | | | | | | | |
function loadScript(src) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
head.appendChild(script);
}
loadScript('fucking/ie8/script.js');