Skip to content

Instantly share code, notes, and snippets.

Rip off
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;
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)
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)
We couldn’t find that file to show.
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,
@schacon
schacon / GitUseCases.txt
Created July 21, 2008 23:30 — forked from sr/GitUseCases.txt
formatted nicer
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,
444 for me!
This is a perfect use for git...
@caffo
caffo / consumobot.rb
Created July 21, 2008 23:45
virtua.com.br bandwidth usage reporter (twitter bot)
#!/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