Skip to content

Instantly share code, notes, and snippets.

@Riveascore
Riveascore / gist:5563810
Last active December 17, 2015 06:18
Reverse sort list of linkedHashMaps according to key!
listOfObjects = []
listOfObjects.add(["tree":tree1, "fitness":0.40, "normalizedFitness":0.0])
listOfObjects.add(["tree":tree2, "fitness":0.17, "normalizedFitness":0.0])
listOfObjects.add(["tree":tree3, "fitness":0.52, "normalizedFitness":0.0])
listOfObjects.sort{ a, b ->
b.getAt("fitness") <=> a.getAt("fitness")
}
// Will sort from as:
(5.581471824914083+(en.energy-((myEnergy+calcAngle(myPos, p))*(p.distanceSq(en.pos)-(calcAngle(en.pos, p)-((en.energy*en.energy)-(myEnergy+en.energy))))))) 0.23428571428571426
(calcAngle(myPos, p)*(myEnergy-((p.distanceSq(en.pos)-calcAngle(en.pos, p))+(((en.energy-0.10831128185178675)-calcAngle(en.pos, p))*3.167648225685385)))) 0.23571428571428574
(myEnergy*(en.energy+(calcAngle(myPos, p)+(((p.distanceSq(en.pos)-calcAngle(en.pos, p))*(calcAngle(en.pos, p)*p.distanceSq(en.pos)))-((calcAngle(en.pos, p)-3.7818169252957503)-en.energy))))) 0.25
((calcAngle(myPos, p)*1.4209814553056568)-(en.energy+(p.distanceSq(en.pos)+(calcAngle(en.pos, p)-(myEnergy-calcAngle(myPos, p)))))) 0.22285714285714286
(((myEnergy*myEnergy)-en.energy)-(p.distanceSq(en.pos)-(calcAngle(en.pos, p)+(4.224485365484653+(calcAngle(myPos, p)+(calcAngle(myPos, p)-((myEnergy-myEnergy)*en.energy))))))) 0.20714285714285716
((calcAngle(en.pos, p)*p.distanceSq(en.pos))+((myEnergy*calcAngle(myPos, p))-(en.energy+((calcAngle(en.pos, p)-1.7088809948199335)
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p180@TCE"
#
# Uncomment the following lines if you want to verify rvm version per project
@Riveascore
Riveascore / quick_browser_detection
Created March 28, 2014 17:05
Quick browser detection
if(window.chrome != undefined) {
}
if(window.opera != undefined) {
}
if(window.mozInnerScreenX != undefined) {
}
if(window.safari != undefined) {
window.detect_browser = function() {
window.is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
window.is_explorer = navigator.userAgent.indexOf('MSIE') > -1;
window.is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
window.is_safari = navigator.userAgent.indexOf("Safari") > -1;
window.is_Opera = navigator.userAgent.indexOf("Presto") > -1;
if ((window.is_chrome)&&(window.is_safari)) {window.is_safari=false;}
}
@Riveascore
Riveascore / gmail_display_none_workaround.html
Last active April 19, 2017 04:46
Currently trying to use inlined "display: none;" doesn't work for Gmail, so here's the best workaround (of about 3 different approaches I tried).
<!--
You can't do position absolute + visibility/opacity in gmail
display: none; only works if you inline it as !important, but then this destroys the functionality for
all other clients, this workaround has been working wonders for us!!!
-->
<style>
div.gmail {
display: block;
width: 0;
overflow: hidden;
@Riveascore
Riveascore / gist:11228317
Created April 23, 2014 19:02
Quick References for email template project
COLORS:
Blue: #459ED8
Red: #E25566
Purple: #9D66AB
Yellow: #EDAE03
Green: #60B687
CSS Classes
@Riveascore
Riveascore / ink_firefox_hack.css
Last active August 29, 2015 14:00
Ink necessary for proper Firefox functioning!
/* Firefox display hack */
@media only screen and (max-width: 600px) {
table[class="body"] .row tr,
table[class="body"] .row tbody {
display: block;
}
}
@Riveascore
Riveascore / ink-tiny-button-mobile-fix.css
Created April 29, 2014 17:06
Quick fix for tiny-buttons' border in mobile view
@media only screen and (max-width: 600px) {
table[class="body"] table.tiny-button td {
width: auto !important;
}
}
@Riveascore
Riveascore / remember_for_TCE.md
Last active October 6, 2015 20:15
To remember for TCE redesign

Generic scroll notifier shadow

Scroll cases

  • When scrolling inline element, add CSS class to allow JS to prevent body scroll when reaching end of element's scroll
  • When scrolling body, don't allow other elements to scroll (another CSS class?), find all elements with overflow auto or scroll, and temporarily add class to prevent scroll, then on stop, remove said class.

Fix ECFE Course dates issue, examples: