Skip to content

Instantly share code, notes, and snippets.

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

Michael Clayton mwcz

🏠
Working from home
View GitHub Profile
@mwcz
mwcz / scrapbook.conf
Created October 14, 2015 15:15
scrapbook
# map the cp-local user hostnames to the remote environment hostnames
map $http_host $upstream_host {
~^dev-.*\.domain\.com$ real.domain.com;
}
# Listen on port 80, but redirect to https/443
server {
listen 80;
server_name ~^(dev|qa|stage|prod).*\.domain\.com$;
@mwcz
mwcz / SassMeister-input-HTML.html
Created March 21, 2015 01:59
Generated by SassMeister.com.
<!DOCTYPE html>
<html>
<head>
<title>PearlHacks Sass!</title>
</head>
<body>
<header>
@mwcz
mwcz / SassMeister-input-HTML.html
Created March 21, 2015 01:08
Generated by SassMeister.com.
<!DOCTYPE html>
<html>
<head>
<title>PearlHacks Sass!</title>
</head>
<body>
<header>PearlHacks Sass!</header>
<main>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
@mwcz
mwcz / prefdep.js
Created February 12, 2015 21:11
prefdep: apply dependencies to all RequireJS modules sharing a common prefix, for example, make 'angular-cookies' and 'angular-translate' depend on 'angular' with `prefdep('angular-', 'angular')`
/* global define, require */
define(['lodash'], function(_) {
'use strict';
function prefdep(prefix, parent_module) {
// grab a convenient reference to the requirejs config
var rjsconf = require.s.contexts._.config;
@mwcz
mwcz / gist:7b96a741d2f1431c8199
Last active August 12, 2018 08:29
casperjs test case example
// googletesting.js
casper.test.begin('Google search retrieves 10 or more results', 5, function suite(test) {
casper.start("http://www.google.fr/", function() {
test.assertTitle("Google", "google homepage title is the one expected");
test.assertExists('form[action="/search"]', "main form is found");
this.fill('form[action="/search"]', {
q: "casperjs"
}, true);
});
@mwcz
mwcz / dhoni.js
Created January 7, 2014 20:44 — forked from sanandnarayan/dhoni.js
// question: why cant Dhoni introduce himself?
// please fix it. Make Dhoni introduce himself!
var Man = function( name ) {
this.name = name
}
Man.prototype.introduce = function() {
console.log( this.name )
}
@mwcz
mwcz / cvs_file_status_codes.txt
Created August 6, 2013 14:26
CVS file status codes
|------|------------|---------------------------------------------------------|
| Code | Meaning | Description |
|------|------------|---------------------------------------------------------|
| ? | what? | It's not a file in CVS. CVS knows nothing about this |
| | | file |
|------|------------|---------------------------------------------------------|
| A | Added | This is a file you just added to CVS but not yet |
| | | committed. You have to commit it before others can see |
| | | it. |
|------|------------|---------------------------------------------------------|
@mwcz
mwcz / colors.conf
Last active December 19, 2015 15:49
Zenburn colorscheme for xchat. Copy this file to ~/.config/xchat2/colors.conf (or wherever your colors.conf is) and let this alien fruit salad keep you in the zone.
color_0 = cccc cccc cccc
color_1 = 1c1c 1c1c 1b1b
color_2 = 6c6c 6c6c 9c9c
color_3 = 8888 b0b0 9090
color_4 = bcbc 6c6c 4c4c
color_5 = e3e3 7171 7070
color_6 = bcbc 6c6c 9c9c
color_7 = dfdf afaf 8f8f
color_8 = f8f8 f8f8 9393
color_9 = 9e9e cece 9e9e
@mwcz
mwcz / jsdoc_AMD_module.md
Last active February 26, 2017 05:36
Michael Mathews (JSDoc founder) explains how @name works and how to document my IIFE-nested multiple-AMD module definitions (wow, that sounds cooooool).

#########

Me:

#########

It's not that I want to avoid those particular tags; I just want to generate the most documentation with the fewest number of tags. Lots of tags start impacting code readability.

Here's a better illustration of my use case. A few constructors are defined inside of an IIFE in order to keep them out of the global namespace. They are then exported with an AMD module definition at the bottom:

(function () {
@mwcz
mwcz / jsdoc_constructor_members.js
Created June 19, 2013 15:05
jsdoc constructor members
// This works
/**
* What is love?
*
* @name Bananana
* @constructor
*/
function Bananana () {