Skip to content

Instantly share code, notes, and snippets.

View tanqhnguyen's full-sized avatar

Tan Nguyen tanqhnguyen

View GitHub Profile
function login(username, password, callback) {
verifyUsername(username, function(error, valid) {
if (error) return callback(error);
if (!valid) return callback('invalid username');
verifyPassword(password, function(error, valid) {
if (error) return callback(error);
if (!valid) return callback('invalid password');
call(null, true);
});
});
@tanqhnguyen
tanqhnguyen / gist:2477247
Created April 24, 2012 06:58
import error
/usr/lib/python2.7/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/local/lib/python2.7/dist-packages/twisted/__init__.pyc, but /usr/local/lib/python2.7/dist-packages/warp-0.2.3-py2.7.egg is being added to sys.path
import pkg_resources
Importing migrations/album.yaml
Importing migrations/artist.yaml
Importing migrations/comment.yaml
Importing migrations/session.yaml
Importing migrations/song.yaml
Importing migrations/submission.yaml
Importing migrations/tag.yaml
Importing migrations/user.yaml
@tanqhnguyen
tanqhnguyen / gist:2477250
Created April 24, 2012 06:58
import error
/usr/lib/python2.7/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/local/lib/python2.7/dist-packages/twisted/__init__.pyc, but /usr/local/lib/python2.7/dist-packages/warp-0.2.3-py2.7.egg is being added to sys.path
import pkg_resources
Importing migrations/album.yaml
Importing migrations/artist.yaml
Importing migrations/comment.yaml
Importing migrations/session.yaml
Importing migrations/song.yaml
Importing migrations/submission.yaml
Importing migrations/tag.yaml
Importing migrations/user.yaml
@tanqhnguyen
tanqhnguyen / gist:2652437
Created May 10, 2012 11:02
Schemup migration
---
table: favorite
from: null
to: tan_1
depends:
- [lyrics_user, bgh_1]
- [song, bgh_16]
sql: |
CREATE TABLE favorite (
id SERIAL NOT NULL PRIMARY KEY,
@tanqhnguyen
tanqhnguyen / gist:2652438
Created May 10, 2012 11:02
Schemup migration
---
table: favorite
from: null
to: tan_1
depends:
- [lyrics_user, bgh_1]
- [song, bgh_16]
sql: |
CREATE TABLE favorite (
id SERIAL NOT NULL PRIMARY KEY,
11:18:24,926 F: (ErlangCore.java:77) : Starting CORE Thread[Worker-9,5,main]
11:18:24,929 I: (ErlangCoreLogger.java:42) : *** starting Erlide v0.16.0.201205031802 (core=0.15.4.201205031802) *** (MacRoman).
11:18:24,933 F: (ErlangCore.java:94) : Started CORE
11:18:24,953 F: (ErlideUIPlugin.java:148) : Starting UI Thread[Worker-9,5,main]
11:18:24,953 F: (ErlideUIPlugin.java:155) : Started UI
11:18:25,182 I: (BackendManager.java:112) : Epmd started.
11:24:28,557 W: (EpmdWatcher.java:104) : Erlide warning: epmd daemon went down on host ZozO-2.local...
===== After updating host file=====
<script id="template">
<div id="hello">
Hello! My name is <%= name %>
</div>
</script>
<script id="template">
<div id="hello">
Hello! My name is <%= name %>
</div>
</script>
@tanqhnguyen
tanqhnguyen / view.js
Created June 6, 2012 10:30
Contact Manager View
var BaseView = Backbone.View.extend({
close: function(){
this.unbind();
if (this.onClose){
this.onClose();
}
}
});
var Dispatch = {};
var BaseView = Backbone.View.extend({
someMethod: function() {
console.info("super");
}
});
var MyView = BaseView.extend({
someMethod: function() {
// call this method from parent
MyView.prototype.someMethod.call(this);