- Thinking I needed it, I looked up how to decode a UTF-8 URL-encoded string in Python.
- Testing Webhooks - I'd assumed there was a "dry run" button but you really do have to commit and push something to test it.
- How do I receive GitHub webhooks in Python? featuring a nice little script that uses Web.py.
- Calling an external command in Python, which recommends subprocess. It wasn't immediately clear in the documentation that you have to [pass it a list of the arguments](http://stackoverflow.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #disqus_thread | |
| script(type='text/javascript') | |
| var disqus_shortname = '#{ disqus_shortname }'; | |
| var disqus_identifier = '#{ disqus_shortname}-#{ current.path.join('-') }'; | |
| (function() { | |
| var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | |
| dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | |
| (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | |
| })(); | |
| noscript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Duane Storey wrote an iPhone-friendly random password in PHP. | |
| # http://www.migratorynerd.com/tips/iphone-friendly-strong-password-generator/ | |
| # "Basically the idea is to only use mostly keys that are accessible without | |
| # having to hit shift or the keyboard button that switches to symbol mode." | |
| # This is a port to Python if you wanted to wanted to generate it using something | |
| # like Pythonista for iOS. http://omz-software.com/pythonista/ | |
| import random | |
| def generate_password(length = 10): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| TODO: * An article that starts a sentence should be capitalized. | |
| * A more comprehensive list of subtleties like "a useful", "a once", "an hour", "an historical" | |
| * Tests | |
| */ | |
| exports.article = function(text) { | |
| var vowels = 'aeiou'; | |
| var an_exceptions = ['eucalyptus', 'eunuch', 'euphemism', 'euphemistic', 'euphonium', 'euphoric', 'european', 'once', 'one', 'onesie', 'union', 'unique', 'unison', 'united', 'useful', 'utopia', 'utopic', 'user', 'unicorn']; | |
| var a_exceptions = ['hour', 'historical', 'honorable', 'honourable']; | |
| if (a_exceptions.indexOf(text) != -1 || (vowels.indexOf(text.charAt(1)) == -1 && an_exceptions.indexOf(text) == -1)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cgi, urllib, urlparse, webbrowser, sys, clipboard, console | |
| argLen = len(sys.argv) | |
| if argLen > 1: | |
| url = sys.argv[1] | |
| else: | |
| url = clipboard.get() | |
| p = urlparse.urlparse(url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ol> | |
| <li>create a file called <code>filter.services.yml</code> file, with the following format: | |
| <code><pre> | |
| services: | |
| plugin.manager.filter: | |
| class: Drupal\modulename\Filter\FilterName | |
| arguments: ['@container.namespaces'] | |
| </pre></code> | |
| Replace <code>modulename</code> with the module's machine name, and <code>FilterName</code> with a unique name for the filter.</li> | |
| <li>create a folder called <code>lib/Drupal/modulename/Plugin</code> (replacing <code>modulename</code> with the module's machine name). In Mac and Unix environments, in the module's folder, you can use the following shell command: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import Image | |
| import base64, zlib | |
| # Jay Parlar convinced me to turn this data structure | |
| # from a dictionary into an object. | |
| class PackedImage(object): | |
| def __init__(self, mode, size, data): | |
| self.mode = mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import Image | |
| import base64, zlib | |
| # Jay Parlar convinced me to turn this data structure | |
| # from a dictionary into an object. | |
| class PackedImage(object): | |
| def __init__(self, mode, size, data): | |
| self.mode = mode |
- Punch in an address or intersection as a starting (and ending) point at http://www.routeloops.com/
- Type in a route length in miles. You might need to convert from km if you're metric like me. You can change the units of measurement in the settings.
- Click "Creat a route of this Length"
- Click "Import/Export"
- Choose GPX (you don't need a large number of points for a route).
- This will open GPX output in a new window/tab. Use the save function of your browser, and give the file a name with the extension .gpx
- If you haven't already, install the RunKeeper GPX bookmarklet at http://jacqueminv.github.io/rkrace-bookmarklet/
- Login to RunKeeper.
- Visit http://runkeeper.com/new/route
- Now click the RunKeeper GPX bookmarklet installed in step #7. You should see a GPX icon on the left side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // based on http://avoidtheinevitable.wordpress.com/2013/01/21/instapaper-random-article-bookmarklet/ updated to | |
| // Instapaper's latest design. This only picks a random article from the first page of Instapaper items | |
| javascript:var l=document.querySelectorAll(".article_item .article_inner_item .host a");l[Math.floor(1+Math.random()*l.length)].click(); |