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 Player | |
| def initialize | |
| @max_health = 20 | |
| @last_health = @max_health | |
| @direction = :forward | |
| end | |
| def update_damage_taken |
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
| // | |
| // ATQuothData.h | |
| // Quoth | |
| // | |
| // Created by Kenneth Ballenegger on 6/15/13. | |
| // Copyright (c) 2013 Kenneth Ballenegger. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
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 'open3' | |
| command = 'ruby test2.rb' | |
| (1..2).map do |n| | |
| Thread.new do | |
| puts "Executing scheduled command: #{command}" | |
| output, status = Open3.capture2e(command) | |
| unless status.success? |
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
| unless File.open('/tmp/transactions.lock', File::RDWR|File::CREAT, 0644).flock(File::LOCK_EX|File::LOCK_NB) | |
| puts 'Cannot lock: Another instance of this script is probably running.' | |
| exit | |
| 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
| // | |
| // Fibonacci generator in C with Y-Combinator powered memoization. | |
| // | |
| // Written by Kenneth Ballenegger in 2013 | |
| // | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <Block.h> |
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
| Do it up to fib # 20... | |
| About to generate # 20 | |
| About to generate # 19 | |
| About to generate # 18 | |
| About to generate # 17 | |
| About to generate # 16 | |
| About to generate # 15 | |
| About to generate # 14 | |
| About to generate # 13 | |
| About to generate # 12 |
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
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| "io/ioutil" | |
| "strings" | |
| ) | |
| const ( |
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 'validations/version' | |
| module Validations | |
| module ClassMethods | |
| # Doubles as setter & getter for @validations | |
| # This method is also the main interface to this lib. | |
| # | |
| def validations(&block) |
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
| typedef void(^CBOfflineCacheContentFetcher)(CBOfflineCacheFetchedContentCallback callback); | |
| typedef void(^CBOfflineCacheFetchedContentCallback)(BOOL success, NSDictionary *content); | |
| typedef void(^CBOfflineCacheCallback)(BOOL success, NSDictionary *content); | |
| [CBOfflineCache fetchContent:@"store-view-boosts" | |
| withFetcher:^(CBOfflineCacheFetchedContentCallback callback){ | |
| // this code does the network access |
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 ruby | |
| require 'scout_api' | |
| group_name = ARGV[0] | |
| Scout::Account.new('...', '...', '...') | |
| all_servers = Scout::Server.all(group_name: 'API') |