Skip to content

Instantly share code, notes, and snippets.

View sindresorhus's full-sized avatar

Sindre Sorhus sindresorhus

View GitHub Profile
@sindresorhus
sindresorhus / Gruntfile.js
Created May 12, 2014 23:57
grunt.next sample
module.exports = function (grunt) {
grunt.oink([{
sass: [{[
filez "hogs.js"
]}]
][0]});
grunt.squeal('sass')[3];
}
@sindresorhus
sindresorhus / yeoman-migrate.md
Last active August 29, 2015 14:06
Yeoman - Migrate from 0.9.6 to 1.0

Source

Old URL: http://yeoman.io/migrate.html

Yeoman - Migrate from 0.9.6 to 1.0

A lot has changed since our last release 0.9.6. We decided to make Yeoman more than just a tool. It's a workflow; a collection of tools and best practices working in harmony to make developing for the web even better.

The first thing you'll notice is that there is no more yeoman command. We extracted the scaffolding into a new tool called yo. For package management we no longer proxy Bower, but let you use it directly. Same goes for grunt.

Keybase proof

I hereby claim:

  • I am sindresorhus on github.
  • I am sindresorhus (https://keybase.io/sindresorhus) on keybase.
  • I have a public key whose fingerprint is DC35 049E A1F5 A23A 232C C7A9 A1D5 B51E 19F6 8B56

To claim this, I am signing this object:

@sindresorhus
sindresorhus / init.py
Created August 28, 2011 18:09
Boxee - Picture player
import mc
mc.ActivateWindow(14000)
item_list = mc.ListItems()
item = mc.ListItem(mc.ListItem.MEDIA_PICTURE)
item.SetPath('http://sindresorhus.com/slider-img/1.jpg')
item.SetImage(0, 'http://sindresorhus.com/slider-img/1.jpg')
item.SetContentType('image/jpeg')
@sindresorhus
sindresorhus / change_form.html
Created October 14, 2011 12:10
Django - If you have 2 date-pickers in the admin form, one for start date and one for end date, this will make sure the second picker is the same month as the first. Which improves the usability of the picker.
{% extends "admin/change_form.html" %}
{% block extrahead %}
{{ block.super }}
<script >
// override openCalendar to set the date of calendar A to calendar B
var _openCalendar = DateTimeShortcuts.openCalendar;
DateTimeShortcuts.openCalendar = function(num) {
_openCalendar.call( this, num );
var cals = DateTimeShortcuts.calendars;
cals[1].drawDate( cals[0].currentMonth, cals[0].currentYear );
@sindresorhus
sindresorhus / compass-task.md
Created October 18, 2012 15:46
grunt-contrib-compass task - feedback wanted

Compass task options - feedback wanted

Need some feedback on how to handle the Compass options.

The problem is that Compass doesn't expose all it's options through the CLI. CLI parameters aren't even documented. This has been a problem for us in Yeoman, since we need an option only available through their config.rb config file.

The idea is to drop the CLI parameters and dynamically create a temp file that we feed into compass from the options specified in the gruntfile.

Currently compass options looks like this:

@sindresorhus
sindresorhus / grunt-contrib task proposal.md
Created October 24, 2012 19:49
grunt-contrib task proposal

grunt-contrib task proposal

We intend extract the tasks included in Yeoman to make the project more modular and be a good internet citizen. We've already done so with the Compass task.

I've added some tasks that might be fitted for grunt-contrib.

grunt-contrib-img

Optimizing images is something most projects need. I think it's important grunt-contrib has a simple and opinionated task for this.

@sindresorhus
sindresorhus / ios-clear-btn.css
Created January 22, 2013 13:54
Recreation of the native iOS textfield clear button in a data uri. *Should be identical, but is not the original*
.clear-btn {
width: 19px;
height: 19px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAAMFBMVEWysrKysrKysrKysrKysrKysrKysrKysrKysrKysrL////39/fh4eG9vb23t7eysrKQDTJbAAAACnRSTlMBKlNxqbO70e7739UFWQAAAMFJREFUeNqNlMsOxSAIREs1AbVe/v9v78JMSn0kMytJTzqIwPWRpKxWimlOcp2U1IM07SHzSbaCor6RTta3+VZ2f6jiB5WboSIncNzKkB+yP0gHlRD/cJjCURdYPrX1F+qtPrCNP+u1Dg5UrYhSzKyBA9VCdhJtwOEICTzjx0jBNfvCLZRnpBa5SCE584WLFEpSfMOBggqJkabkFciCkOUlH4t7erKRuLYkm5wbGXIAuXHmlgO3asjFxa9BfqmSK/oPfl489V95hyMAAAAASUVORK5CYII=');
background-size: 100%;
cursor: pointer;
}
@sindresorhus
sindresorhus / doesnotwork.js
Created March 1, 2013 00:33
The `works.js` outputs `Serving HTTP on 0.0.0.0 port 8010 ...` while the `doesnotwork.js` doesn't output anything. Am I missing something? Node v0.8.21
var spawn = require('child_process').spawn;
var cp = spawn('python', ['-m', 'SimpleHTTPServer', '8010']);
cp.stdout.setEncoding('utf8');
cp.stderr.setEncoding('utf8');
cp.stdout.on('data', function (data) {
console.log('stdout', data);
});