Discover gists
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
Rip off |
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 () { | |
var firstPosition = $('status').value.indexOf("http://"); | |
var endPosition = $('status').value.indexOf(" ", firstPosition); | |
if (endPosition == -1) { | |
if ($('status').value.charAt(document.getElementById('status').selectionEnd - 1) == '.') { | |
var endPosition = document.getElementById('status').selectionEnd - 1; | |
} | |
else | |
{ | |
var endPosition = document.getElementById('status').selectionEnd; |
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
def get_object_or_404(klass, *args, **kwargs): | |
queryset = _get_queryset(klass) | |
try: | |
return queryset.get(*args, **kwargs) | |
except queryset.model.DoesNotExist: | |
raise Http404('No %s matches the given query.' % queryset.model._meta.object_name) | |
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
def get_object_or_404(klass, *args, **kwargs): | |
try: | |
return queryset.get(*args, **kwargs) | |
except queryset.model.DoesNotExist: | |
raise Http404('No %s matches the given query.' % queryset.model._meta.object_name) | |
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
01:21 <schacon> well like, lets say you use Emacs, and someone | |
posts an extension on gists, like this: http://gist.github.com/290 | |
01:22 <schacon> you use it and think it's cool, but add some | |
features, so you can fork it, make your change and even email | |
the original author, who can add you as a remote and merge your | |
change in, or several peoples changes and push back | |
01:23 <schacon> you have a list of all the gists you've ever made, | |
and can always go back and edit or update them: http://gist.github.com/mine | |
01:24 <schacon> if you have a multi-file project, like a little | |
sinatra app that maybe doesn't warrant it's own github project, |
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
01:21 <schacon> well like, lets say you use Emacs, and someone | |
posts an extension on gists, like this: http://gist.github.com/290 | |
01:22 <schacon> you use it and think it's cool, but add some | |
features, so you can fork it, make your change and even email | |
the original author, who can add you as a remote and merge your | |
change in, or several peoples changes and push back | |
01:23 <schacon> you have a list of all the gists you've ever made, | |
and can always go back and edit or update them: http://gist.github.com/mine | |
01:24 <schacon> if you have a multi-file project, like a little | |
sinatra app that maybe doesn't warrant it's own github project, |
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
444 for me! |
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
This is a perfect use for git... |
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/ruby | |
# consumobot.rb - virtua.com.br bandwidth usage reporter (twitter bot) | |
# non-copyright (c) 2008 rodrigo franco <caffo@imap.cc> | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |