Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
using Castle.MicroKernel.Lifestyle;
using Castle.Windsor;
using System;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Dispatcher;
using Library.Api.Web;
namespace Library.Api.Windsor
{
@kenkam
kenkam / gist:1159757
Created August 20, 2011 22:31
list comprehension
# i can haz python 2.6.6+
with open('file.txt') as f:
lines = f.readlines()
for l in lines:
if 'safeChange' in l:
lines[lines.index(l)] = 'nyan nyan nyan'
<html>
<head>
<script type="text/javascript">
// when the document has finished loading...
window.onload = function() {
// get the element with my_link as ID, and bind a callback for the onclick event
document.getElementById("my_link").onclick = function() {
// change the CSS style declared when the link is clicked
document.getElementById("my_div").innerHTML = '<p>A new paragraph</p>';
}
@kenkam
kenkam / trim_space.c
Created January 21, 2011 17:58
A simple function to trim some space off a string in C
char * trim_space(char *str) {
char *end;
/* skip leading whitespace */
while (isspace(*str)) {
str = str + 1;
}
/* remove trailing whitespace */
end = str + strlen(str) - 1;
while (end > str && isspace(*end)) {
end = end - 1;