I hereby claim:
- I am scardine on github.
- I am scardine (https://keybase.io/scardine) on keybase.
- I have a public key ASC9JweFtSgQkSwSXJ-VQnXADDR1vYsbW3NF7D20RmpWYAo
To claim this, I am signing this object:
import os | |
from base64 import b64encode | |
import requests | |
from django.conf import settings | |
from django.template.loader import render_to_string | |
import magic | |
try: |
import os | |
from base64 import b64encode | |
import requests | |
from django.conf import settings | |
from django.template.loader import render_to_string | |
import magic | |
try: |
I hereby claim:
To claim this, I am signing this object:
# coding=utf-8 | |
import re | |
import time | |
from selenium.webdriver import PhantomJS | |
from selenium.webdriver.support.ui import Select | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
DCAP = dict(DesiredCapabilities.PHANTOMJS) | |
DCAP.update({ |
From a discussion with Martijn Pieters at stackoverflow
This is meant as a comment, posted as an answer because it is too big for the comment system. Answering to Martijn Pieters:
PauloScardine: but now you are inserting a value lookup each iteration. That's not more efficient. And in this specific case, you'd have to call
vars(MyClass)
too, or do an extra attribute lookup withMyClass.__dict__
Probably the difference is marginal, but it is always good to profile before claiming some code is more efficient than other, so here we go:
$ python --version
Python 2.7.6
// https://github.com/blacklocus/angular-django-rest-resource | |
angular.module('app.services', ['ngResource'], function($provide) { | |
$provide.factory('ModelName', function($resource) { | |
return djResource('/v1/model-name/pk:id/', {pk:'@id'}); | |
}); | |
$provide.factory('OtherModelName', function($resource) { | |
return djResource('/v1/other-model-name/pk:id/', {pk:'@id'}); | |
}); | |
}) |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = angular.element.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | |
break; |
-- Delete any ACL allowing everyone to own ticlets for any queue | |
DELETE FROM ACL WHERE id IN ( | |
SELECT id FROM ACL WHERE RightName='OwnTicket' AND objecttype='RT::Queue' AND principalid IN ( | |
SELECT id FROM Groups WHERE domain='SystemInternal' AND type='Everyone' | |
) | |
); |