Skip to content

Instantly share code, notes, and snippets.

--- a/cttt.user.js
+++ b/cttt.user.js
@@ -339,7 +339,7 @@ function letsJQuery() {
};
return new _timer(interval, callback);
};
-
+ waitPlugins($);
posts = $('div.post')
max_post = posts.length
@linuxfood
linuxfood / gist:1474361
Created December 13, 2011 23:02
Django ModelForm custom fields in ModelAdmin
from django.contrib import admin
from django import forms
class MyModelAdmin(admin.ModelAdmin):
# ...
def get_form(self, request, obj=None, **kwargs):
form_factory = super(MyModelAdmin, self).get_form(request, obj, **kwargs)
form_factory.base_fields['my_custom_field'] = forms.CharField(widget=forms.Textarea(), required=True)
# ...
def save_model(self, request, obj, form, change):
@linuxfood
linuxfood / gist:1523175
Created December 27, 2011 09:47
Fan out task distribution test
/*
Results (Tests run on a Core i7 Mac with 8gb of RAM).
NOTE: These results are not meant to be statistically
significant, only to give a glimpse at the behavior of
the Rust scheduler so far. I've run each of the below
configurations more times than I show below, these are
just a sample of each. Independent runs show basically
the same behavior*.
@linuxfood
linuxfood / gist:1537715
Created December 30, 2011 03:53
Rust typing error?
use std;
// uniq mut vec of mut f64
type umvomf64 = ~mutable [ mutable f64 ];
fn mk_umvomf64() -> umvomf64 {
ret ~mutable [ mutable ];
}
fn main() {
let cnt = 10u;
@linuxfood
linuxfood / gist:1954260
Created March 2, 2012 00:28
Django auto-generated admin actions
def puser_setcompanyroutines():
routines = []
for c in Company.objects.all():
fn = lambda modeladmin, request, queryset: queryset.update(company=c)
# WTF, you say? Yep. That's because django actually cares about the NAME
# of the function handles you pass it in the actions list. Stupid.
fn.__name__ = "set_company_%d" % c.id
fn.short_description = "Set selected to company %s" % c.name
routines.append(fn)
return routines

Keybase proof

I hereby claim:

  • I am linuxfood on github.
  • I am bcs (https://keybase.io/bcs) on keybase.
  • I have a public key ASDGk8dxZ8GZeFE53QgiuUjqxOQLaEMN4wDhlINwsREinQo

To claim this, I am signing this object:

# Pre-change search:
bash-3.2$ autopkg search Firefox
Name Repo Path
---- ---- ----
FirefoxESR64-Win.filewave.recipe andredb90-recipes Firefox ESR - Win64/FirefoxESR64-Win.filewave.recipe
OpenKiosk.munki.recipe apizz-recipes OpenKiosk/OpenKiosk.munki.recipe
EMCSyncplicity.pkg.recipe bkerns-recipes EMCSyncplicity/EMCSyncplicity.pkg.recipe
EMCSyncplicitySSO.pkg.recipe bkerns-recipes EMCSyncplicitySSO/EMCSyncplicitySSO.pkg.recipe
TechSmithCamtasia.pkg.recipe bkerns-recipes TechSmithCamtasia/TechSmithCamtasia.pkg.recipe
TechSmithSnagit.pkg.recipe bkerns-recipes TechSmithSnagit/TechSmithSnagit.pkg.recipe
# Pre-change info:
bash-3.2$ autopkg info -p GoogleChrome.munki
Didn't find a recipe for com.github.autopkg.munki.googlechromepkg.
Found this recipe in repository: recipes
Attempting git clone...
Adding /Users/testing/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes to RECIPE_SEARCH_DIRS...
Updated search path:
'.'
'~/Library/AutoPkg/Recipes'
$ python3 Scripts/run_tests.py
...WARNING: plist error for fake: __enter__
................................Nothing found.
.
To add a new recipe repo, use 'autopkg repo-add <repo name>'
.No search query specified!
.
To add a new recipe repo, use 'autopkg repo-add <repo name>'
Warning: Search yielded more than 100 results. Please try a more specific search term.
$ ./Code/autopkg info -p GoogleChrome.munki -d /Users/Shared/RecipeOverrides -d /Users/Shared/Recipes
Didn't find a recipe for com.github.autopkg.munki.googlechromepkg.
Found this recipe in repository: recipes
Attempting git clone...
Adding /Users/testuser/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes to RECIPE_SEARCH_DIRS...
Updated search path:
'.'
'~/Library/AutoPkg/Recipes'
'/Library/AutoPkg/Recipes'