Skip to content

Instantly share code, notes, and snippets.

View AphonicChaos's full-sized avatar

AphonicChaos AphonicChaos

View GitHub Profile
def some_view(request):
form = SomeForm(request.POST)
form_json = {
name: {
"help_text": field.help_text,
"initial": field.initial,
"label": field.label[:],
"max_length": field.max_length,
"min_length": field.min_length,
"required": field.required,
// GET /profile/edit/telephone/
var new_profile_unit = {
"fields": [
{
"name": "date_created",
"type": "DateTimeField"
},
{
"name": "date_updated",
"type": "DateTimeField"
/* global React AddressProfileUnit AddressProfileUnitForm ProfileUnitContainer */
const fakeResponse = {
"address": [
{
"address_line_one": "STRING",
"address_line_two": "STRING",
"city_name": "STRING",
"country_code": "STRING",
"country_sub_division_code": "STRING",
module Main where
import Util (unzipWith)
count :: [(Bool, Bool)]
count = do
d1 <- [1..8]
d2 <- [1..8]
d3 <- [1..8]
d4 <- [1..8]
linux-vdso.so.1 (0x00007fffdf3ab000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f5e625c8000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f5e623ab000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f5e621a3000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f5e61f2c000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f5e61bea000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00007f5e619df000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x00007f5e617d4000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f5e61452000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f5e61154000)
#site_packages_widget = FSM('Sites', reverse_lazy('site_fsm'), async=True)
#site_packages_widget = fields.AutoCompleteSelectMultipleWidget('sites')
site_packages_widget = admin.widgets.FilteredSelectMultiple(
"Site", False)
self.fields['site_packages'] = ModelMultipleChoiceField(
queryset=sites, help_text='', label='Site', required=False,
widget=site_packages_widget)
module Main where
import Data.Set hiding (foldr)
fromFoldable :: (Foldable f, Ord a) => f a -> Set a
fromFoldable = foldr insert empty
someSet = fromList [1, 2, 2, 3]
main = do
module Main where
g :: (a -> b) -> [a] -> [b]
g f (x:xs) = [f x]
main = print $ g (+1) [1, 2, 3]
foo = (Foo.objects
.filter(something)
.filter(something_else))