Skip to content

Instantly share code, notes, and snippets.

var red = '#c00'
var white = '#fff'
console.log('<table border=0 cellspacing=0 cellpadding=0 style="line-height:10px">\n' + ([
'111111111111111111',
'1 1 1 1',
'1 1 1 1 1 1 1 1',
'1 1 1 1 1 1 1 1',
'1 1 1 1 1 1 1',
'111111 1111111111',
@cybear
cybear / error-messages.md
Created March 10, 2015 09:04
Writing tips for error messages

Writing tips for error messages

  • Describe the cause of the error, if possible.
  • Avoid blaming the user. "You typed a URL that doesn't exist" => "We can't find any page at this URL"
  • Avoid impersonal writing. "Could not upload selected files" => "We could not upload the files that you selected"
  • Suggest a next action for the user if it is plausible.
require.extensions[".json"] = function (module, filename) {
module.exports = JSON.parse(require("fs").readFileSync(filename, "utf8"))
}

A pure CSS bendy shadow:

I suspect that some trig calculations could make this very general.

bendy_shadow

@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
@simme
simme / _mixins.sass
Created May 25, 2011 12:20
SASS Mixins
// Rounds all the corners of a box
@mixin border-radius($radius, $clip: padding-box)
-webkit-border-radius: $radius
-moz-border-radius: $radius
-o-border-radius: $radius
border-radius: $radius
-webkit-background-clip: $clip
-mox-background-clip: $clip
-o-background-clip: $clip
background-clip: $clip
@simme
simme / drupal_table_pager.php
Created August 23, 2012 11:51
Drupal table with pager from db_select()
<?php
/**
* Display point award report.
*
* Generates a list of awarded points.
*
* @return array $content
*/
function game_report_page_points() {
// For some mysterious reason only parts of the db_select API is chainable.
@simme
simme / app.js
Last active May 16, 2019 05:59
Gulp file for an Ember project using bower and browserify.
// Load Ember into the global scope by requiring it
require('ember');
// Go have fun
var app = Ember.Application.create();
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.