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
# place this snippet into init.coffee in ~/.atom directory | |
atom.workspace.observeTextEditors (editor) -> | |
if editor.getTitle() isnt "untitled" | |
sp = editor.getPath().split('/') | |
title = sp.slice(sp.length-2).join('/') | |
editor.getTitle = -> title | |
editor.getLongTitle = -> title | |
for item in atom.workspace.getPaneItems() |
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
// uses jquery | |
$.ajax({ | |
type: "POST", | |
url: "{% url 'attachment-object-coupling' project.slug %}", | |
data: { | |
attachment: attachments.attr("id"), // attachment instance_id | |
object: objects.attr("id"), // object instance_id | |
csrfmiddlewaretoken: '{{ csrf_token }}' // if not configured to include token in every post | |
}, | |
success: function(data) { |
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
#pip install watchdog | |
#sudo apt-get install xvkbd | |
#!/bin/bash | |
watchmedo shell-command \ | |
--patterns="*.rst" \ | |
--ignore-pattern='_build/*' \ | |
--recursive \ |
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
from selenium import webdriver | |
from lxml import html | |
#Get the page source as altered by the browser | |
browser = webdriver.Firefox() | |
url='http://www.amazon.com/Levi-Magic-Pants-Douglas-Bradshaw-ebook/dp/B0086K9JI0/' | |
browser.get(url) | |
html_source = browser.page_source | |
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
//From http://stackoverflow.com/questions/3677400/making-a-http-post-request-using-arduino | |
IPAddress server(10,0,0,138); | |
String PostData = "someDataToPost"; | |
if (client.connect(server, 80)) { | |
client.println("POST /Api/AddParking/3 HTTP/1.1"); | |
client.println("Host: 10.0.0.138"); | |
client.println("User-Agent: Arduino/1.0"); | |
client.println("Connection: close"); |
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
#Testing syntax highlighting. | |
import requests | |
r=float(requests.get("http://www.nnums.com/api/get/CCCCCC.n").text) | |
print 'I love strings' |
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
To change a field name in django 1.7+ | |
1. Edit the field name in the model (but remember the old field name: you need it for step 3!) | |
2. Create an empty migration | |
$ python manage.py makemigrations --empty myApp | |
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding | |
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'), | |
to the operations list. |
NewerOlder