Skip to content

Instantly share code, notes, and snippets.

View relrod's full-sized avatar

Rick Elrod relrod

View GitHub Profile
function last_line_containing($str, $item) {
$lines = split($str, "\n");
foreach($lines as $line)
$ret = stristr($line, $item);
return $ret;
}
namespace Foo
{
class Bar : Controller
{
public ActionResult MyAction(int? id)
{
var ctx = new Models.MyDbContext();
return from x in ctx.MyTable where x.ID == id select x.Name;
}

Comments

  • /* */
  • //

Function Definition

:function1 [str1 str2]

:string (join " " [str1 str2])

@relrod
relrod / test.php
Created January 8, 2011 19:19 — forked from JAChapmanII/test.php
<html>
<head>
</head>
<body>
<pre>
<?php
$json = file_get_contents( "http://github.com/api/v2/json/repos/show/JAChapmanII" );
$output = json_decode( $json );
foreach( $output->repositories as $repo ) {
case class Person(name: String, age: Int) {
def <=>(person: Person) = age compare person.age
override def toString = name + " (" + age + ")"
}
val group = List(
Person("Bob", 33),
Person("Chris", 16),
Person("Ash", 23)
)
#!/bin/bash
for i in {1..64}; do
./errbit 2400 hts1_2k4.c2 hts1_2k4_$i.c2 $i;
done;
Please help compile a list of all Scala-related IRC rooms.
All of these channels are on Freenode.
#akka | concurrency & distribution framework
#argonaut | json library
#fp-in-scala | the book Functional Programming in Scala
#geotrellis | geoprocessing library
#indyscala | regional scala group
#json4s | json library
@relrod
relrod / AlaCarte.hs
Last active August 29, 2015 14:07 — forked from puffnfresh/AlaCarte.hs
module AlaCarte where
-- Control.Monad.Free
data Free f a = Free (f (Free f a)) | Pure a
instance Functor f => Monad (Free f) where
Pure a >>= f = f a
Free r >>= f = Free (fmap (>>= f) r)
return = Pure