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
package com { | |
package object openstudy { | |
def nameForStringField(fn:(String)=>Any) : String = { | |
S.fmapFunc(S.SFuncHolder(string => fn(string)))((name:String) => name) | |
} | |
def nameForFileUploadField(fn:(FileParamHolder)=>Any) : String = { | |
S.fmapFunc(S.BinFuncHolder(fph => if (fph.length > 0) fn(fph)))((name:String) => name) | |
} | |
def nameForSubmitButton(fn:()=>JsCmd) : String = { | |
S.fmapFunc(S.NFuncHolder(fn))((name:String) => name) |
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
class RestoringWeakReference[T <: AnyRef](private var reference:WeakReference[T], restorer:()=>T) { | |
def value : T = { | |
val existing = reference.get | |
if (! existing.isDefined) { | |
restoreReference | |
value | |
} else { | |
existing.get | |
} | |
} |
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
// Helpers for distances in words. | |
class TimeDeltaHelpers(timeDelta:Long) { | |
// Turns the time delta (in milliseconds) into a word distance, e.g. `5 | |
// days ago' or `3 hours ago'. | |
def distanceInWords : String = { | |
fuzzyTimeFromDelta(timeDelta) | |
} | |
private val second = 1 | |
private val minute = 60 * second |
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
package bootstrap.liftweb { | |
import net.liftweb.common._ | |
import net.liftweb.http._ | |
import js._ | |
import LiftRules._ | |
import net.liftweb.util.Helpers._ | |
/** | |
* Provides automatic reloading of the client on session loss. | |
* |
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
.popup { | |
position: relative; | |
font-size: 12px; | |
width: 300px; | |
background-color: #28C0F7; | |
color: white; | |
padding: 15px; |
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
function loadTooltip(tooltipHtml) { | |
var $tooltip = $(tooltipHtml); | |
$tooltip.append('<div class="arrow" />'); | |
$('body').append($tooltip.hide()); | |
$tooltip.fadeIn(); | |
} |
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
<div class="popup left-arrow"> | |
<h5>Stumped?</h5> | |
<p>Post your question here and other people on OpenStudy will help you find | |
the answer!</p> | |
<a class="close">close</a> | |
<div> | |
<input id="hide-tips" type="checkbox" /> | |
<label for="hide-tips">Don't show tips</label> |
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 script requires fish-nuggets, available at: | |
# http://github.com/nirvdrum/fish-nuggets | |
function svnc --description "Commit from git master to SVN." | |
if not is-git | |
echo "svnc can only be run from a git repository." | |
return | |
end | |
set -l branch (env git symbolic-ref -q HEAD) |
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
ko.nativeTemplateEngine = function () { | |
function nodeListToArray(nodeList) { | |
var array = []; | |
for (var i = 0; i < nodeList.length; ++i) | |
array[i] = nodeList[i]; | |
return array; | |
} |
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
package bootstrap.liftweb { | |
import net.liftweb.common._ | |
import net.liftweb.http._ | |
import js._ | |
import LiftRules._ | |
import net.liftweb.util.Helpers._ | |
/** | |
* Provides automatic reloading of the client on session loss. | |
* |