Skip to content

Instantly share code, notes, and snippets.

@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@staltz
staltz / introrx.md
Last active May 17, 2024 01:39
The introduction to Reactive Programming you've been missing
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 16, 2024 20:53
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Rob--W
Rob--W / background.js
Created March 20, 2014 00:05
Implementation example of writable response bodies for Chromium extensions (API draft).
/**
* Implementation example of writable response bodies.
* Based on the draft of the Streams API (19 March 2014)
* https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm
* Design document for response body reading/writing:
* https://docs.google.com/document/d/1iE6M-YSmPtMOsec7pR-ILWveQie8JQQXTm15JKEcUT8
*/
/* globals chrome, ByteStream, URL, XMLHttpRequest */
'use strict';
@anhulife
anhulife / WeixinDetection.js
Created January 17, 2014 09:22
判断网页是否是在微信内嵌浏览器中打开
document.addEventListener('WeixinJSBridgeReady', function(){
//如果执行到这块的代码,就说明是在微信内部浏览器内打开的.
alert('当前页面在微信内嵌浏览器中打开!');
});
@cesarandreu
cesarandreu / AngularJS Provider Test Example
Last active February 6, 2018 17:59
Example of how you can test your AngularJS providers.
Look at the README.
@fengmk2
fengmk2 / mongoskin-demo.js
Created September 5, 2011 11:29
mongoskin CRUD demo
var mongo = require('mongoskin');
var db = mongo.db('127.0.0.1:27017/test');
// create index:
// key, unique, callback
db.collection('user').ensureIndex([['name', 1]], true, function(err, replies){});
// bind method: db.user ===> db.collection('user')
db.bind('user');
@timkindberg
timkindberg / app.js
Last active May 11, 2016 16:04
ng-forward ng1 migration (after)
import { Component, bundle } from 'ng-forward';
import { ComponentA } from './component-a';
import { ComponentB } from './component-b';
@Component({
selector: 'app',
directives: [ ComponentA, ComponentB ]
})
export class App { }
@kamikat
kamikat / journal.js
Created August 18, 2014 04:54
A node.js server module generating xlsx file using elxml.
var _ = require('lodash');
var path = require('path');
var moment = require('moment');
var request = require('superagent');
var excel = require('elxml');
var conf = require('../../configure');
var upstream = conf.upstream;
var baseuri = 'http://' + upstream.host + ':' + upstream.port;