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
| $(document).ready(function() { | |
| var closeMenu = function() { | |
| $('#container').unbind('touchmove'); | |
| $("#container").animate({"margin-left": "0"}, { | |
| duration: 700, | |
| complete: function() { | |
| $('#content').css('width', 'auto'); | |
| $('#contentLayer').css('display', 'none'); |
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
| with open('./search/data/seo_service_landing_service_data.yml') as f: | |
| service_data = yaml.safe_load(f) | |
| for x in service_data: | |
| service_data[x]['see_also'] = [TOP_TEN[i] for i in (random.sample(xrange(len(TOP_TEN)), 4))] | |
| with open('./search/data/seo_service_landing_service_data.yml', 'w') as f: | |
| pyaml.dump(service_data, f) |
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
| TASK: [common | upgrade system packages] ************************************** | |
| failed: [celery_stats_testing] => {"failed": true, "item": ""} | |
| stdout: Reading package lists... | |
| Building dependency tree... | |
| Reading state information... | |
| Initializing package states... | |
| Writing extended state information... | |
| Resolving dependencies... | |
| The following NEW packages will be installed: | |
| liblcms2-2{a} linux-headers-3.2.0-64{a} linux-headers-3.2.0-64-virtual{a} |
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
| require 'msf/core' | |
| require 'crypt/blowfish' # sorry, openssl is limited to 16-byte key size :( | |
| # add gem 'crypt', '1.1.4' to Gemfile | |
| module ::Crypt | |
| class Blowfish | |
| def setup_blowfish() | |
| @sBoxes = Array.new(4) { |i| INITIALSBOXES[i].clone } | |
| @pArray = INITIALPARRAY.clone | |
| keypos = 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
| from collections import defaultdict | |
| def isUnique(string): | |
| seen = defaultdict(lambda: False) | |
| for x in string: | |
| if not seen[x]: seen[x] = True | |
| else: return False | |
| return 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
| def fib(n): | |
| return reduce(lambda x, y: [x[1], x[0] + x[1]], xrange(n-2), [0, 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
| def fizzbuzz(n): | |
| print "\n".join([('Fizz'*(not i%3) + 'Buzz'*(not i%5)) if ((not i%3) or (not i%5)) else str(i) for i in xrange(1, n+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
| public void shuffleCards (int[] cards){ | |
| int temp, index; | |
| for (int i = 0; i < cards.length; i++){ | |
| index = (int) (Math.random() * (cards.length - i)) + i; | |
| temp = cards[i]; | |
| cards[i] = cards[index]; | |
| cards[index] = temp; | |
| } | |
| } |
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
| unsigned int i; | |
| for(i=100; i<=0; --i) | |
| print(i) |
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 validParentheses? str | |
| a = [] | |
| str.each_char do |x| | |
| if x == '(' | |
| a.push x | |
| elsif x == ')' | |
| return false if a.pop == nil | |
| end | |
| end | |
| a.empty? |