Skip to content

Instantly share code, notes, and snippets.

@poundifdef
poundifdef / angular_select
Last active December 22, 2015 23:09
Download this and name it "angular.html". (If you don't, this demo won't work.) This gives me the console error: "query function not defined for Select2 tags". whyyyyy.
<!--
Download this and name it "angular.html". (If you don't, this demo won't work.)
This gives me the console error: "query function not defined for Select2 tags". whyyyyy.
-->
<html>
<head>
<link href="https://rawgithub.com/ivaynberg/select2/master/select2.css" rel="stylesheet">
@poundifdef
poundifdef / gist:6814155
Created October 3, 2013 17:59
Using ng-repeat in a nested loop: how do I differentiate different models with the same name?
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script type="text/javascript">
var samplePage = angular.module('samplePage', []);
@poundifdef
poundifdef / setup_server.yml
Last active December 25, 2015 00:49
ansible set up server
---
- hosts: api
user: root
tasks:
- name: Set up github private key
copy: src=FOO dest=/root/.ssh/github mode=0600
@poundifdef
poundifdef / dictionaries.py
Last active December 27, 2015 04:48
Objects versus dictionaries: which do you like better?
from common import APIException
from database import db
from flask import request
required_fields = ['name', 'subject', 'text', 'html']
def _template_to_api(template):
return template
def _validate_template(template):
<!-- POST https://wwwcie.ups.com/ups.app/xml/Track -->
<?xml version="1.0"?>
<AccessRequest>
<AccessLicenseNumber>LICENSE</AccessLicenseNumber>
<Password>PASSWORD</Password>
<UserId>USERID</UserId>
</AccessRequest>
<?xml version="1.0"?>
In [9]: months = list(rrule.rrule(
rrule.MONTHLY,
dtstart=datetime(2013, 4, 1),
until=datetime.now() + timedelta(days=31),
bymonthday=1,
bysetpos=1,
))
In [10]: months
Out[10]:
@poundifdef
poundifdef / output1.txt
Created March 11, 2014 20:53
celery timeouts
jay@gillespie:~/celery$ celery -A tasks worker --loglevel=info -c 1
[2014-03-11 16:49:53,468: INFO/MainProcess] Received task: mytask[9d6b1e2c-aae7-4314-a7fe-90810b0bd4ac]
[2014-03-11 16:49:53,471: WARNING/Worker-1] hi there
[2014-03-11 16:50:23,502: INFO/MainProcess] Task mytask[9d6b1e2c-aae7-4314-a7fe-90810b0bd4ac] succeeded in 30.031816568s: hello world
@poundifdef
poundifdef / crackle.py
Created May 4, 2014 03:14
FizzBuzz in Enterprise Python
#!/usr/bin/python
#
# To run: `python crackle.py`
# To run tests: `python -m unittest crackle`
from collections import defaultdict
import unittest
def crackle_popper():
Q: How many lawyers does it take to change a light bulb?
A: Whereas the party of the first part, also known as "Lawyer", and the
party of the second part, also known as "Light Bulb", do hereby and forthwith
agree to a transaction wherein the party of the second part shall be removed
from the current position as a result of failure to perform previously agreed
upon duties, i.e., the lighting, elucidation, and otherwise illumination of
the area ranging from the front (north) door, through the entryway, terminating
at an area just inside the primary living area, demarcated by the beginning of
the carpet, any spillover illumination being at the option of the party of the
second part and not required by the aforementioned agreement between the
@poundifdef
poundifdef / gist:ec16836913cc4c9fa1fb
Created September 2, 2014 22:17
jira confluence stack trace
Cause
java.lang.IllegalStateException: Google properties not yet initialised
at com.atlassian.agmp.integration.common.enablement.impl.GooglePropertiesHolder.getGoogleProperties(GooglePropertiesHolder.java:40)
Stack Trace:[hide]
java.lang.IllegalStateException: Google properties not yet initialised
at com.atlassian.agmp.integration.common.enablement.impl.GooglePropertiesHolder.getGoogleProperties(GooglePropertiesHolder.java:40)
at sun.reflect.GeneratedMethodAccessor3946.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)