Skip to content

Instantly share code, notes, and snippets.

@wolf0403
wolf0403 / node-phantom-reverseproxy.js
Created July 22, 2013 05:21
Deajaxify page for Google crawler with Node.js / Phantom.js
var http = require('http'),
phantom=require('node-phantom'), // https://github.com/alexscheelmeyer/node-phantom
urlparse = require('url');
function proxy_url(url, res) {
phantom.create(function(err,ph) {
return ph.createPage(function(err,page) {
@willurd
willurd / Getting started with requirejs.md
Last active August 7, 2024 06:24
A short introduction to require.js

This is a small collection of scripts showing how to use require.js. It's only one of several ways of setting up a require.js project, but it's enough to get started.

At its core, require.js is about three things:

  1. Dependency management
  2. Modularity
  3. Dynamic script loading

The following files show how these are achieved.

@winsonwq
winsonwq / counter.js
Last active September 7, 2016 17:28
闭包练习三
// function counter(initValue, seed) {}
// testcase
var incrementByOneFromOne = counter(1, 1);
incrementByOneFromOne.should.include.keys('value');
incrementByOneFromOne.should.include.keys('increment');
incrementByOneFromOne.should.include.keys('decrement');
// testcase
var incrementByOneFromOne = counter(1, 1);
@branneman
branneman / better-nodejs-require-paths.md
Last active October 18, 2024 20:29
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@gaearon
gaearon / ClassNameMixin.js
Last active March 23, 2018 17:18
BEM in React
'use strict';
var React = require('react'),
classSet = require('react/lib/cx'),
_ = require('underscore');
var ClassNameMixin = {
propTypes: {
className: React.PropTypes.string,
context: React.PropTypes.string
@gpbl
gpbl / reflux-master-detail.md
Last active November 3, 2015 13:19
Using Reflux stores and actions for a Master/Detail app with React

Reflux stores and actions in a Master/Detail app

Example and reasonings when using Reflux stores and actions for a Master/Detail app with React – with an eye to server-side rendering. Some concepts apply to reflux#166 and reflux#180.

Requirements

Must work with a router

This hypotetical app would use a router to display a list of items (e.g. at the url example.org/items, the master view) and a single item (e.g. example.org/items/:id, the detail view).

@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active November 12, 2024 14:35
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub