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 binarySearch(list, value){ | |
var states = new Array; | |
var state = new Object; | |
state.done = false; | |
state.b = 0; | |
state.e = list.length; | |
state.m = Math.floor((state.b+state.e)/2); | |
//states.push(state.clone()); | |
while(list[state.m] != value && state.b < state.e){ | |
if(value > list[state.m]){ |
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
express = require('express') | |
app = module.exports = express.createServer() | |
app.configure = -> | |
app.set 'views', __dirname + '/views' | |
app.set 'view engine', 'jade' | |
app.use express.bodyParser() | |
app.use express.methodOverride() | |
app.use express.compiler({ src: __dirname + '/public', enable: ['less'] }) | |
app.use app.router |
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
The procedure for setting up automatic private/public key login on our servers is as follows: | |
- On your own machine, go to $HOME/.ssh and type: ssh-keygen -t dsa | |
- When prompted for it, leave the default location for the file and let the passphrase empty | |
- Copy the content of the "id_dsa.pub" file that just got created into the $HOME/.ssh/authorized_keys and authorized_keys2 on our machine. | |
- Set the following permissions: | |
chmod 644 $HOME/.ssh/authorized_keys* |
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
/* HTML5 ✰ Boilerplate | |
* ==|== normalize ========================================================== | |
*/ | |
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } | |
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } | |
audio:not([controls]) { display: none; } | |
[hidden] { display: none; } | |
html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } |
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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: gunicorn | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the gunicorn server | |
# Description: starts gunicorn using start-stop-daemon |
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
Ext.util.Observable.prototype.fireEvent = | |
Ext.createInterceptor(Ext.util.Observable.prototype.fireEvent, function() { | |
console.log(this.name); | |
console.log(arguments); | |
return true; | |
}); |
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
import time | |
def log_timing(func): | |
def wrapper(*arg): | |
t1 = time.time() | |
res = func(*arg) | |
t2 = time.time() | |
print "%s took %d ms" % (func.func_name, (t2-t1)*1000.0) | |
return res | |
return wrapper |
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
insert('This is a line added by the user. \n This is another line added by the user.', A, B) | |
insert('This is yet another line added by the user.' B, null) |
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
class app.view.ProfileListView extends Backbone.View | |
events: | |
"click li.js_profile": "select_click_person" | |
"click li.js_next_page": "next_page" | |
"click li.js_prev_page": "prev_page" | |
"click .close": "filter_x_click" | |
"click .order_buttons button": "order_by" | |
initialize: -> | |
@loading_overlay_el = $('#js_overlay_'[email protected]) |
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
from django.conf import settings | |
from django.conf.urls.defaults import patterns, url | |
import os | |
urlpatterns = patterns('',) | |
if settings.DEBUG: | |
urlpatterns += patterns('', | |
url(r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.getcwd()}) | |
) |
OlderNewer