This file contains 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 earliest_start_time(task: Int, solution: Solution): Int = { | |
var current_earliest = 0 | |
solution.task_list.filter(p => p.task_id == task).foreach{p => | |
p.precedence_constraint.foreach{r => | |
solution.task_list.filter(y => y.task_id == r).foreach{t => | |
if (t.precedence_constraint.isEmpty == true) { | |
if (t.empty_start_time == true){ | |
return 0 | |
}else{ |
This file contains 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 iterate_values(current_values: Array[Array[Double]]): Array[Array[Double]] = { | |
val new_values: Array[Array[Double]] = Array.fill[Double](initial_condition.size, initial_condition(0).size)(0.0) | |
for (i <- 0 until initial_condition.size) { | |
for (j <- 0 until new_values(i).size) { | |
new_values(i)(j) = sor_formula(current_values, i, j) | |
} | |
} | |
} |
This file contains 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
[info] Compiling 1 Scala source to /home/godzirra/code/target/scala-2.9.1/classes... | |
[error] /home/godzirra/code/fraud.scala:25: type mismatch; | |
[error] found : scala.collection.immutable.Iterable[Int] | |
[error] required: Seq[?] | |
[error] var temp = scala.collection.mutable.ArrayBuffer((array_1):_*) | |
[error] ^ | |
[error] /home/godzirra/code/fraud.scala:34: value sortWith is not a member of scala.collection.immutable.Iterable[Int] | |
[error] val result = fraud_exclaimation_point.sortWith(_.compareTo(_) < 0).mkString(",") | |
[error] ^ | |
[error] two errors found |
This file contains 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
# This is used for debugging callbacks chains, to use this code: | |
# 1. Drop this into an initializer in your rails app | |
# 2. Set the LG_FILE_PATH to the file location you want the logging to go too | |
# 3. Set MODEL_TO_DEBUG to the class you want to debug, ie: MODEL_TO_DEBUG | |
# 4. Change the print_string method to save the relevant information. It has | |
# access to any instance methods on the object presently in the callback chain | |
# Note: Not sure how compatible this is with other versions of rails/state-machine | |
# VERSIONS PATCHED | |
# State-Machine 1.1.2 |
This file contains 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
# Generate random text via an online API: Useful for generating fake data | |
# For more options see: https://baconipsum.com/json-api/ | |
#Generate random sentence | |
require 'open-uri' | |
def random_sentence(count=1); open("https://baconipsum.com/api/?type=meat-and-filler&sentences=#{count}&format=text&start-with-lorem=0").read; end | |
# < random_sentence | |
# => "Bacon ipsum dolor amet aute brisket cupidatat ribeye, ball tip consequat shoulder pig chuck adipisicing shankle." | |
# Random paragraph | |
def random_paragraph(count=1); open('https://baconipsum.com/api/?type=meat-and-filler¶s=#{count}&format=text&start-with-lorem=0').read; end |
This file contains 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
# Remove any existing version of libxml2 2.13.3 | |
brew uninstall libxml2 | |
# Create a new tap | |
brew new-tap $GITUSER/homebrew-core | |
# Copy over the current formula for libxml2 to your new tap | |
cp $(brew --repository homebrew/core)/Formula/libxml2.rb $(brew --repository $GITUSER/homebrew-core)/Formula/ | |
# Open the formula (replace `code` with whatever editor you use |
This file contains 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
# Remove any existing version of libxml2 2.13.3 | |
brew uninstall libxml2 | |
# Create a new tap | |
brew new-tap $GITUSER/homebrew-core | |
# Copy over the current formula for libxml2 to your new tap | |
cp $(brew --repository homebrew/core)/Formula/libxml2.rb $(brew --repository $GITUSER/homebrew-core)/Formula/ | |
# Open the formula (replace `code` with whatever editor you use |