Skip to content

Instantly share code, notes, and snippets.

Ben Alman cowboy

Block or report user

Report or block cowboy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get install -y build-essential curl
# NodeJS >= 6.0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
# ttfautohint
@cowboy
cowboy / synth.cpp
Created Sep 14, 2017 — forked from genericpenguin/synth.cpp
Arduino Synth
View synth.cpp
/* Arduino Synth from
https://janostman.wordpress.com/2016/01/15/how-to-build-your-very-own-string-synth/
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
@cowboy
cowboy / 0_reuse_code.js
Created Nov 30, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View 01.mobile.test.js
mobile: function() {
return Modernizr.mq("only all and (max-width: 480px)");
}
View shebangs
#!/ricky martin
View grunt-task-definition-options.js
// inside a gruntfile
grunt.registerTask('awesome', {
description: 'The most awesome task ever.',
type: 'multi',
main: function(grunt, arg) {
var files = grunt.file.expandFiles(grunt.util._.pluck(this.files, 'src'));
var success = this.task.listFiles(grunt, files);
grunt.log.writeln('Stuff happened...');
if (success) { grunt.log.ok(); } else { grunt.log.error(); }
},
@cowboy
cowboy / gist:3086861
Created Jul 10, 2012 — forked from rmurphey/gist:3086328
What's wrong with Netmag's "Optimize your JavaScript" post
View gist:3086861

What's wrong with Netmag's "Optimize your JavaScript" post

I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.

Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).

Things that are just plain wrong

  • Calling array.push() five times in a row will never be a "performance improvement." The author has clearly co
@cowboy
cowboy / self-assessment.md
Created May 23, 2012 — forked from rmurphey/self-assessment.md
Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" Training
View self-assessment.md

Self-Assessment for Bocoup's "Foundations of Programming with JavaScript" training

This gist is aimed at helping you assess whether you'll be a good fit for Bocoup's "Foundations of Programming with JavaScript" training. This class is aimed at introducing you to fundamental concepts of development using JavaScript. In this class, you'll work through the process of building a simple game of hangman; along the way, you'll learn about functions, arrays, objects, and prototypes, and get a brief introduction to the jQuery library. You'll also learn about approaches that will help you write more maintainable code, and get introduced to tools for debugging and testing your JavaScript.

@cowboy
cowboy / grunt.md
Created Apr 25, 2012 — forked from mikesherov/grunt.md
getting grunt to work on windows with cygwin and git
View grunt.md

Getting grunt to work with Cygwin and git on Windows is a bit difficult considering the cygwin package that is installed by git has an outdated version of node running on it. There are several issues to work through:

  1. Cygwin by default installs an old version of node.
  2. Open Cygwin shell
  3. which node tells you where the executable is
  4. node --version tells you if it's old
  5. cd to the directory listed by which node
  6. mv node.exe node.exe.bak
  7. download node from nodejs.org and install it
  8. Node installed through installer doesn't update PATH to point to correct version of node installed normally.
You can’t perform that action at this time.