Skip to content

Instantly share code, notes, and snippets.

View anhnt's full-sized avatar
🏠
Working from home

Anh anhnt

🏠
Working from home
View GitHub Profile
Windows Registry Editor Version 5.00
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
var truth = function() { return true; };
var relativeTruth = function() { return false; };
var assert = function(func) {
return func() == true;
};
var wrapper = function(func) {
// perform setup work here
@anhnt
anhnt / Account.js
Created January 7, 2014 10:02
Passport authenticate with SailsJS (v0.98)
// api/models/Account.js
module.exports = {
attributes: {
acct_id: {
type: 'int',
primaryKey: true
},
loginName: {
type: 'string',
// api/services/passport.js
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var bcrypt = require('bcrypt-nodejs');
passport.serializeUser(function(user, next) {
next(null, user.id);
});
/**
* A simple example of how to use Waterline v0.10 with Express
*/
var express = require('express'),
_ = require('lodash'),
app = express(),
Waterline = require('waterline');
@anhnt
anhnt / forever
Created June 19, 2014 09:57
forever nodejs
Forever works now on windows, I currently use it.
Just do:
npm install forever -g
and to run it, assuming you're in the app.js directory:
(sudo) forever -c node -w app.js
@anhnt
anhnt / google-map-places-demo.html
Last active August 29, 2015 14:04
google place autocomplete
<!DOCTYPE html>
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
<script>
window.onload = function(){
var locationField = document.getElementById('locationField');
var input = document.createElement('input');
input.setAttribute('id','autocomplete');
input.setAttribute('type','text');
Câu 1. Bạn hãy cho biết đoạn code sau sẽ in ra gì ở Javascript console
(function($){
$(function(){
var a = 1;
b = 2;
window.c = 3;
});
})(jQuery);
console.log(a);
a = 4;
@anhnt
anhnt / gist:e5ab383ce039855a96fe
Created March 20, 2015 10:10
fomula home credit
var a = $(".result span:first");
var c = b[0]; // object calculator
c.calc.data = [{
"1000000": 208000,
"2000000": 416000,
"3000000": 625000,
"4000000": 833000,