Skip to content

Instantly share code, notes, and snippets.

View rrichardson's full-sized avatar
💭
⚔️ Hacking Away

Rick Richardson rrichardson

💭
⚔️ Hacking Away
View GitHub Profile
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ExistentialQuantification #-}
projectFields :: EntityDef -> [DB.Field]
projectFields ent = zipWith (DB.:=) (getFields ent) [1,2..]
def load[ChartType : Manifest](opts : ForexChartOptions) {
val mainchart = new ChartType(opts)
mainchart.pack()
RefineryUtilities.centerFrameOnScreen(mainchart)
mainchart.setVisible(true)
}
def load[ChartType : Manifest](opts : ForexChartOptions) {
val ctClass = implicitly[Manifest[ChartType]].erasure
val mainchart = ctClass.newInstance.asInstanceOf[ChartType]
mainchart.pack()
RefineryUtilities.centerFrameOnScreen(mainchart)
mainchart.setVisible(true)
}
libraryDependencies ++= {
val liftVersion = "2.4-M4" // Put the current/latest lift version here
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
"net.liftweb" %% "lift-paypal" % liftVersion % "compile->default",
"net.liftweb" %% "lift-machine" % liftVersion % "compile->default",
"net.liftweb" %% "lift-textile" % liftVersion % "compile->default",
"net.liftweb" %% "lift-wizard" % liftVersion % "compile->default",
"net.liftweb" %% "lift-mongodb" % liftVersion % "compile->default",
"net.liftweb" %% "lift-mongodb-record" % liftVersion % "compile->default")
trait SlashemField[V, M <: Record[M]] extends OwnedField[M] {
def valueBoxFromAny(a: Any): Box[V] = {
try {
Full(a.asInstanceOf[V])
} catch {
case _ => Empty
}
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=620">
<title>Slider demo</title>
<link type="text/css" href="css/flick/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<style>
@rrichardson
rrichardson / ?
Created March 27, 2012 21:22
this
fn readZip(fname: str) -> io::reader unsafe {
let mode= "r";
let fptr = str::as_c_str(fname) {|f| str::as_c_str(mode) { |m| libc::popen(f, m) }; };
io::FILE_reader(fptr, true);
}
fn main() {
let rd = readZip("unzip -p \*.zip");
}
#[link(name = "import",
vers = "0.1",
uuid = "0b3f44de-9dba-44e9-958e-087f00c6b82f",
url = "https://dunno/yet")];
#[comment = "A test project for"];
#[author = "Rick Richardson"];
#[license = "Unknown"];
#[crate_type = "bin"];
var flatiron = require('flatiron'),
ecstatic = require('ecstatic'),
socketful = require('socketful'),
restful = require('restful'),
resourceful = require('resourceful');
var app = module.exports = flatiron.app;
app.use(flatiron.plugins.http, {
before: [