Skip to content

Instantly share code, notes, and snippets.

View ryanve's full-sized avatar
📶
stay free

deepskyblue ryanve

📶
stay free
View GitHub Profile
@thefoxis
thefoxis / jsfest-slides.md
Last active September 22, 2015 23:24
Slides from JavaScript Fest individual events in Oakland, 7th-13th Dec, 2014.
@GarrettS
GarrettS / newApply.js
Created March 10, 2011 05:49
newApply
function F(){}
function newApply(ctor, args) {
var i,
fp = F.prototype = ctor.prototype; // Copy prototype.
if(fp) {
fp.constructor = ctor;
}
i = new F;
ctor.apply(i, args); // Apply the original constructor.
return i;
@tkadlec
tkadlec / imageCheck.js
Created August 10, 2012 18:53
Determine if image has been downloaded
var myImage = new Image();
myImage.src = "http://somedomain.com/image2.png";
if (myImage.complete) {
//already downloaded
} else {
//not yet downloaded
}
@renoirb
renoirb / dabblet.css
Created July 1, 2013 23:49
Lea Verou's CSS Lightbox, taken on webplatform.org
/**
* Lea Verou's CSS Lightbox, taken on webplatform.org
* For redistribution purposes
* @author Lea Verou <lea@w3.org>
*/
#lightbox {
visibility: hidden;
position: fixed;
top: 50%;
left: 50%;
@cdaringe
cdaringe / grunt-npm-dedupe.js
Created June 29, 2015 01:25
grunt npm dedupe
var spawnSync = require('spawn-sync');
var NODE_ENV = process.env.NODE_ENV;
var production = (NODE_ENV === 'production');
/**
* `npm dedupe` in cwd
* @return {undefined}
*/
var dedupe = function() {
var result;
@bobholt
bobholt / resources.md
Last active August 30, 2016 05:24
JavaScript Development Resources

This is a work in progress. If I missed something or someone, please let me know!

Best Practices

It's hard to recommend best practices in general without context, but basically, writing clean, readable code with lots of comments, and doing a lot of automated unit testing, followed by an automated build process using ANT or Grunt to concatenate and minify files is a start.

Twitter

I don't focus much on blogs any more. I focus more on Twitter. If the people I follow there recommend something, I'll go read it. Here's the best of my Twitter list, including developers, conferences, and interesting groups. There are other great developers on Twitter, but these tweet mostly about development:

Developers

@ryanve
ryanve / namespacing.md
Last active February 16, 2017 04:02
Namespacing CSS libraries

Imagine a web application that uses multiple CSS frameworks, libraries, components, etc. Class names are bound to conflict. Imagine two libraries: freeform.css and aid.css

Namespaced by prefixing classes

<a class="freeform-text--bold freeform-display--block aid aid--focusable">example</a>

Namespaced by data attribute

<a data-freeform="text--bold display--block" data-aid="focusable">example</a>
const makeRequest = async () => {
const value1 = await promise1()
const value2 = await promise2(value1)
return promise3(value1, value2)
}
@prestonparris
prestonparris / reactjs-conf-2015-notes.md
Last active April 6, 2017 21:32
Notes from the 2015 React.js Conference

Reactjs conf 2015 Notes

  • react native announced

    • Allows you to use react style javascript to target native ios and android, native views, live reloading
    • intro pt1
    • intro pt2
    • facebook groups app uses react native with graphql and relay
  • realtime page tweaking

    • rethink best practices and workflows
  • inmutability is a good idea

@cgbystrom
cgbystrom / npm-linked-pkgs.js
Created October 15, 2014 21:37
Get a list of all NPM linked packages
var util = require('util');
var exec = require('child_process').exec;
function getNpmLinkedPackages (callback) {
exec('npm list --global', function (error, stdout, stderr) {
if (error) return callback(error);
if (stderr.length > 0) return callback(stderr);
var pkgs = stdout
.split('\n')