Skip to content

Instantly share code, notes, and snippets.

View CacheConfig.java
public class CacheConfig extends CachingConfigurerSupport {
public void init() {
innerConnectionFactoryInitaaaa();
}
}
View animal_example.scala
class Animal {
def say = { println("I am an animal") }
}
trait Furry extends Animal {
abstract override def say = { super.say; println("I am a furry animal") }
}
trait HasLegs extends Animal {
abstract override def say = { super.say; println("I have legs") }
}
trait FourLegs extends HasLegs {
View akka_fsm.scala
import akka.actor._
import scala.concurrent.duration._
import scala.collection.immutable
// received events
case class SetTarget(ref: ActorRef)
case class Queue(obj: Any)
case object Flush
// sent events
case class Batch(obj: immutable.Seq[Any])
@kerie
kerie / geocoding
Created Jul 2, 2012
A sample use of google map api
View geocoding
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var geocoder;
var map;
@kerie
kerie / geocoding
Created Jul 2, 2012
A sample use of google map api
View geocoding
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
@kerie
kerie / ns
Created May 8, 2012 — forked from hooopo/ns
ns
View ns
有人用过cell么?
<span style="font-size: small;"><a target="_blank" href="http://rubyforge.org/frs/?group_id=2978&amp;release_id=9650">http://rubyforge.org/frs/?group_id=2978&amp;release_id=9650</a>
<br /></span>
<br /><span style="font-size: small;"> </span>
<br /><span style="font-size: small;">
<br />非常小,源代码一目了然。感觉虽然有点土,但比自己做个module的方式好一点点
<br />号称: 代替发挥component作用的controller, 这样就不需要邪恶的render_component了
<br /></span>
<br /><span style="font-size: small;">A cell acts as a lightweight controller in the sense that it will assign variables and render a view.</span>
View ai.js
var AI = {};
new function(){
AI.Pattern= pattern;
// 定义了 8 个偏移量
// 可以简单通过加法得到任一点周围 8 个点的坐标
// -11 -10 -9
// -1 x 1
// 9 10 11
// 如左上角的坐标为 x + (-11)
var directions=[-11,-10,-9,-1,1,9,10,11];
View Makefile
obj-m := exercise2.o
KDIR :=/lib/modules/$(shell uname -r)/build
PWD :=$(shell pwd)
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
View exercise1.c
#include <stdlib.h>
int main()
{
system("echo 'this is a test' > /proc/13081070/keke");
}
View example.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#define STRINGLEN 1024
char global_buffer[STRINGLEN];
struct proc_dir_entry *example_dir, *hello_file, *current_file, *symlink;