This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInt(n) { | |
if (n == 1 || n == 2 || n == 3 || n == 4 || n == 5 || n == 6 || n == 7 || n == 8 || n == 9 || n == 0) { | |
return true | |
} else { | |
return false | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#query-input").typeahead({ | |
source: ["Hello", "World", "Autocomplete"], | |
highlighter: function(item) { | |
return item + "!"; | |
}, | |
updater: function(item) { | |
alert(item, "is chosen"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formatPhone: function(phone) { | |
return phone.replace(/(\d\d\d)(\d\d\d)(\d\d\d\d)/, '($1) $2-$3'); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BusinessItemView = Marionette.ItemView.extend({ | |
tagName: "li", | |
template: "item-view-template" | |
}); | |
var BusinessCollectionView = Marionette.CompositeView.extend({ | |
template: "collection-view", | |
itemView: BusinessItemView, | |
itemViewContainer: "#item-container", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Split string into array | |
# SPLITTED_ARRAY is a global array to store split result | |
# | |
# Usage example: | |
# | |
# split "1,2,3", "," | |
# result=0 | |
# for i in ${SPLITTED_ARRAY[*]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName your-domain.com | |
RewriteEngine On | |
RewriteRule ^(.*)$ http://localhost:4000$1 [P] | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> &split(const string &s, char delim, vector<string> &elems) { | |
stringstream ss(s); | |
string item; | |
while (getline(ss, item, delim)) { | |
elems.push_back(item); | |
} | |
return elems; | |
} | |
vector<string> split(const string &s, char delim) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <dirent.h> | |
#include <utime.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <sys/sendfile.h> | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <dirent.h> | |
#include <sys/stat.h> | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
#include <sstream> |