Skip to content

Instantly share code, notes, and snippets.

View runningdemo's full-sized avatar
🏠
Working from home

Demo runningdemo

🏠
Working from home
View GitHub Profile
@necolas
necolas / README.md
Last active March 28, 2024 20:34
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@markd2
markd2 / unsafe.m
Created October 4, 2012 14:25
Play with ARC variable lifetime qualifiers
#import <Foundation/Foundation.h>
// clang -g -fobjc-arc -Wall -framework Foundation -o unsafe unsafe.m
@interface NSThing : NSObject
@end
@implementation NSThing
- (void) dealloc {
@nverinaud
nverinaud / javascript-prototyping-best-practices.js
Created November 11, 2012 10:03
Javascript Prototyping Best Practices
'use strict';
/*
# Javascript Prototyping Best Practices
* To create a class, create a constructor function with a `Name` and assign
it to a variable of the same `Name`.
* In this constructor only define properties using `this.prop` notation
@nibblebot
nibblebot / multiwatch.js
Created December 5, 2012 17:35
Handlebars and Coffeescript Watcher
function addSlashes( str ) {
return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}
var spawn = require('child_process').spawn;
var growl = require('growl');
var coffee = './node_modules/.bin/coffee';
var coffee_tasks = [];
var handlebars_tasks = [];
coffee_tasks.push(spawn(coffee, ['-cwo', 'static/js', 'static/coffee']));
coffee_tasks.push(spawn(coffee, ['-cwo', 'test', 'test/src']));
@dciccale
dciccale / git_branch.sh
Created May 11, 2013 18:02
Bash script to get the current git branch and last commit
#!/usr/bin/env bash
# checks if branch has something pending
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
# gets the current git branch
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
@branneman
branneman / better-nodejs-require-paths.md
Last active June 27, 2024 10:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@will-hart
will-hart / build.py
Last active January 26, 2023 12:35
Super Simple Static Site Generator (Python)
"""
Free to use under the MIT license
Builds a static site from a list of Markdown source files. The source
files should have the same directory structure as the desired output.
Files are rendered using Markdown2 and can declare metadata variables:
---
@Jamesits
Jamesits / Qujing Cached PAC 20150711.js
Last active March 17, 2017 12:10
PAC script downloaded at Jul 11, 2015 5:04:17 PM
dnsDomainIs = function (h, d) {
return h.indexOf(d, h.length - d.length) !== -1 && (d.length === h.length || h.indexOf("." + d, h.length - ("." + d).length) !== -1)
}
function FindProxyForURL(u, h) {
h = h.toLowerCase();
if (h === "appdownload.itunes.apple.com" || dnsDomainIs(h, "battlenet.com.cn") || dnsDomainIs(h, "dist.blizzard.com.edgesuite.net") || /us-ore-\d+\.s3\.amazonaws\.com/.test(h) || /\w{2}-\w{3}-\d{5}\.s3\.amazonaws\.com/.test(h)) {
return "DIRECT"
}
a = []; // user ignore list
@tanyuan
tanyuan / smart-caps-lock.md
Last active June 18, 2024 19:36
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.