This file contains hidden or 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
// Source: http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php | |
function CleanWordHTML( str ) | |
{ | |
str = str.replace(/<o:p>\s*<\/o:p>/g, "") ; | |
str = str.replace(/<o:p>.*?<\/o:p>/g, " ") ; | |
str = str.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ; | |
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ; | |
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ; | |
str = str.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ; |
This file contains hidden or 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
Django | |
====== | |
Person should have a ManyToMany field to 'self' through a Marriage model. The | |
field should be symmentrical so that both people konw they are married to each | |
other. The Marriage model contains information about the marriage, such as it | |
start, end, etc. | |
/----------------------\ |
This file contains hidden or 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
# Manually connecting to the server via ssh and executing | |
$ gunicorn_django -c gunicorn --daemon settings_server.py | |
# ... works fine. | |
# But running the same thing via Fabric, does not. | |
# Yes, I'm in the right directory and yes it's in virtualenv. | |
# The command succeeds, but gunicorn isn't running afterwards. | |
# gunicorn.py | |
# bind = '127.0.0.1:8888' |
This file contains hidden or 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
// Photo class | |
// ----------- | |
// | |
// Attributes: | |
// - filename | |
// - height | |
// - width | |
// - mimetype | |
// - filesize |
This file contains hidden or 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 current xobni way | |
var Photo = function() { | |
this.img = $('<img/>'); | |
this.caption = $('<p/>'); | |
}; | |
Photo.prototype.setImgClick = function(callback) { | |
this.img.click(callback); | |
}; |
This file contains hidden or 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 status = { | |
enginesOn: true, | |
acOn: false | |
}; | |
var toggle = function(obj, key) { | |
if (obj[key]) obj[key] = false; | |
else obj[key] = true; | |
}; |
This file contains hidden or 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 X | |
delegate: (selector, eventName, method) -> | |
$(el).delegate selector, eventName, -> | |
method @ |
This file contains hidden or 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($) { | |
})(jQuery || django.jQuery); |
This file contains hidden or 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
expect = require 'expect.js' | |
formatPhoneNumber = (number) -> | |
length = number.length | |
console.log number | |
if number[0] is '1' | |
switch length | |
when 1 |
This file contains hidden or 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
qs = (arr) -> | |
if arr.length <= 1 | |
return arr | |
[].concat qs(i for i in arr when i < arr[0]), [arr[0]], qs(i for i in arr when i > arr[0]) |