Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| // number to string, pluginized from http://stackoverflow.com/questions/5529934/javascript-numbers-to-words | |
| window.num2str = function (num) { | |
| return window.num2str.convert(num); | |
| } | |
| window.num2str.ones=['','one','two','three','four','five','six','seven','eight','nine']; | |
| window.num2str.tens=['','','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety']; | |
| window.num2str.teens=['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']; |
| from functools import update_wrapper | |
| from django.contrib import admin | |
| from django.contrib.admin import ModelAdmin | |
| from django.contrib.admin.templatetags.admin_urls import add_preserved_filters | |
| from django.core.exceptions import PermissionDenied | |
| from django.shortcuts import render | |
| from myapp.models import Widget | |
| from myapp.forms import ManageWidgetForm |
| var shouldStoreDouble: Double = 200.0 // we restrict this by adding an annotation | |
| print("Double annotation ", shouldStoreDouble); | |
| // let see when we say our computer should create | |
| // a memory space for string but we try to store an integer | |
| var onlyStringPlease: String = "John" | |
| print("String annotation ", onlyStringPlease) |
| Source : https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging | |
| java -cp gwt-dev.jar com.google.gwt.dev.Compiler | |
| Missing required argument 'module[s]' | |
| Google Web Toolkit 2.3.0 | |
| Compiler [-logLevel level] [-workDir dir] [-gen dir] [-style style] [-ea] [-XdisableClassMetadata] [-XdisableCastChecking] [-validateOnly] [-draftCompile] [-optimize level] [-compileReport] [-strict] [-localWorkers count] [-war dir] [-deploy dir] [-extra dir] module[s] | |
| where | |
| -logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL | |
| -workDir The compiler's working directory for internal use (must be writeable; defaults to a system temp dir) |
| def flatten_array(arr): | |
| output = [] | |
| for val in arr: | |
| if type(val) == list: # is the current value we are looking at is also a list | |
| output.extend(flatten_array(val)) # then recursive call itself to start from | |
| # the beginning and use python list extend | |
| else: | |
| output.append(val) # ok this is not a list just append to the bottom | |
| return output |
| var myResponse = {"start_date":["A valid integer is required."], | |
| "end_date":["A valid integer is required."], "commite":["Require commite."]} | |
| //iterate over the serializer error message | |
| for (var prop in myResponse) { | |
| var errorValue = myResponse[prop]; | |
| //test if the current prop has an _ in it string value | |
| var _pattern = /_/; | |
| if (_pattern.test(prop)) { |
| var myResponse = {"start_date":["A valid integer is required."], | |
| "end_date":["A valid integer is required."], "commite":["Require commite."]} | |
| //iterate over the serializer error message | |
| for (var prop in myResponse) { | |
| var errorValue = myResponse[prop]; | |
| //test if the current prop has an _ in it string value | |
| var _pattern = /_/; | |
| if (_pattern.test(prop)) { |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| #!/usr/bin/env python | |
| import boto | |
| import sys, os | |
| from boto.s3.key import Key | |
| from boto.exception import S3ResponseError | |
| DOWNLOAD_LOCATION_PATH = os.path.expanduser("~") + "/s3-backup/" | |
| if not os.path.exists(DOWNLOAD_LOCATION_PATH): |
| #After looking for a way to check if a model instance can be deleted in django , | |
| #i came across many sample, but was not working as expected. Hope this solution can help. | |
| #Let start by creating an Abstract model class which can be inherited by other model | |
| class ModelIsDeletable(models.Model): | |
| name = models.CharField(max_length=200, blank=True, null=True, unique=True) | |
| description = models.CharField(max_length=200, blank=True, null=True) | |
| date_modified = models.DateTimeField(auto_now_add=True) | |