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/env python | |
| def fizzbuzz(start=1, stop=100): | |
| for i in xrange(start, stop + 1): | |
| if i % 3 == 0 and i % 5 == 0: | |
| yield "FizzBuzz" | |
| elif i % 3 == 0: | |
| yield "Fizz" | |
| elif i % 5 == 0: |
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/env python | |
| import sys | |
| import pika | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| 'localhost')) | |
| channel = connection.channel() | |
| channel.queue_declare(queue='hello', durable=True) |
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
| username: vagrant | |
| password: vagrant | |
| sudo apt-get update | |
| sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev | |
| sudo aptitude install mysql-server mysql-client | |
| sudo nano /etc/mysql/my.cnf | |
| change: |
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
| Vagrant::Config.run do |config| | |
| config.vm.box = "lucid64" | |
| config.vm.box_url = "http://files.vagrantup.com/lucid64.box" | |
| config.vm.host_name = "myvagrantbox" | |
| # etc. | |
| end |
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
| libraries.add({ | |
| text: 'My libraries', | |
| requires: '//cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.1/ember.js', // optional | |
| scripts: [ | |
| { text: 'Ember Data 0.8.0', url: '//cdnjs.cloudflare.com/ajax/libs/ember-data.js/0.8.0-latest20121123/ember-data-latest.min.js' } | |
| ] | |
| }) |
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
| -- Check if Growl is running | |
| tell application "System Events" | |
| set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0 | |
| end tell | |
| -- Get URI of current Spotify track | |
| tell application "Spotify" | |
| set theTrack to current track | |
| set theID to id of theTrack | |
| set theName to name of theTrack |
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/env python | |
| import sys | |
| import time | |
| import uuid | |
| from functools import partial | |
| import pika | |
| connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) |
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
| class AccountMeta(models.Model): | |
| key = models.CharField(max_length=240, db_index=True) | |
| value = models.TextField() | |
| account = models.ForeignKey(SocialAccount, related_name='meta') | |
| created_at = models.DateTimeField(auto_now_add=True, db_index=True) | |
| updated_at = models.DateTimeField(auto_now=True) | |
| class Meta: | |
| unique_together=('account', 'key') | |
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/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Simple Cloudant client, which is basically just a thin wrapper around the | |
| requests.Session class. | |
| Usage: | |
| import cloudant |
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
| ✎ v runworker | |
| Warning: Permanently added 'emmasocial-streaming.local,192.168.33.43' (RSA) to the list of known hosts. | |
| [*] Waiting for tasks. To exit press CTRL+C | |
| INFO: 2013-05-15 22:00:20,434 - pika.adapters.base_connection - base_connection - _create_and_connect_to_socket - 174 - Connecting fd 3 to localhost:5672 | |
| ================================================================================ | |
| INFO: 2013-05-15 22:00:20,477 - pika.adapters.blocking_connection - blocking_connection - _adapter_connect - 232 - Adapter connected | |
| ================================================================================ | |
| [*] Consuming from amq.gen-aO47xdlh0Zh5WQW-EQKz-w queue | |
| [*] Consuming from start.consumer queue | |
| INFO: 2013-05-15 22:00:30,770 - root - base - start_a_consumer - 417 - Starting consumer id steveWINton |