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 medley.extensions.models.story import MedleyStory | |
| for story in MedleyStory.objects.all(): | |
| story.reindex(using='solr4_aws') |
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
| [{u'canonical_url': u'www.local.cmgsharedcontent.com:8000/gallery/news/national/photos-mudslide-block-both-directions-roadway-near/gCJnS/', | |
| u'categories': [u'/News/National', u'/News', u'/News/Disasters'], | |
| u'content_created': u'2014-03-22T19:57:12Z', | |
| u'content_modified': datetime.datetime(2014, 3, 27, 7, 9, 4, 404000, tzinfo=<DstTzInfo 'America/New_York' EDT-1 day, 20:00:00 DST>), | |
| u'details': {u'django_ct': u'photos.medleygallery', | |
| u'django_id': u'118454', | |
| u'id': u'photos.medleygallery.118454', | |
| u'indexed_date': datetime.datetime(2014, 8, 22, 16, 20, 49, 177000, tzinfo=<DstTzInfo 'America/New_York' EDT-1 day, 20:00:00 DST>), | |
| u'page_title': u'PHOTOS: Deadly mudslide in Washington'}, | |
| u'first_created': u'2014-03-22T19:57:12Z', |
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
| ''' | |
| Project Euler problem 477 | |
| url: https://projecteuler.net/problem=477 | |
| ''' | |
| import sys | |
| def sequence_gen(n): | |
| ret = 0 | |
| i = 0 | |
| while i < n: |
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
| def sequence_gen(n): | |
| ret = 0 | |
| i = 0 | |
| while i < n: | |
| yield ret | |
| ret = ((ret**2) + 45) % 1000000007 | |
| i += 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
| def fbgen(n): | |
| for i in n: | |
| if i % 15 == 0: yield 'Fizzbuzz' | |
| elif i % 3 == 0: yield 'Fizz' | |
| elif i % 5 == 0: yield 'Buzz' | |
| else: yield i | |
| if __name__ == '__main__': | |
| for fb in fbgen(range(1,100)): | |
| print fb |
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
| def _available_moves(game_state): | |
| #return a list of available moves on the board. | |
| return [i for i, j in enumerate(game_state) if j != 'X' and j != 'O'] |
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
| function sortByName() { | |
| return function(x, y) { | |
| return ((x.fullname == y.fullname) ? 0 : ((x.fullname > y.fullname) ? 1 : -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 sys | |
| if len(sys.argv) == 3: | |
| names = sys.argv[1].split('.') | |
| name_space = '.'.join(names[0:-1]) | |
| caller = names[-2] | |
| class_name = names[-1] | |
| method_file = sys.argv[2] | |
| #import from names as strings | |
| test_lib = __import__(name_space) | |
| methods = __import__(method_file) |
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
| ########################################################### | |
| # How many ig'nant people have named their child some # | |
| # version of "Khaleesi" (which is just an honorific, # | |
| # similar to "queen" - her name is Daenerys Targaryen) # | |
| ########################################################### | |
| #SPOILER ALERT: It's over 900. | |
| #Commands: |
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
| #define a fibonacci enumerator | |
| fibonacci = Enumerator.new do |yielder| | |
| a = b = 1 | |
| loop do | |
| yielder << a | |
| a, b = b, a + b | |
| end | |
| end | |
| #curry cache to infinity |