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
<head> | |
<meta charset="utf-8" /> | |
<title>My Weblog</title> | |
<!--[if lt IE 9]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
</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
// source: <http://www.2ality.com/2011/11/javascript-classes.html> | |
var PersonProto = { | |
describe: function () { | |
return "Person called " + this.name; | |
}, | |
}; | |
var jane = { | |
__proto__: PersonProto, | |
name: "Jane", | |
}; |
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
import re, sys | |
for line in sys.stdin: | |
print re.sub(r"<(?![ ]*/?[ ]*(p|br)\b)[^>]*>", "", line) |
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
var basketModule = (function() { | |
var basket = []; //private | |
return { //exposed to public | |
addItem: function(values) { | |
basket.push(values); | |
}, | |
getItemCount: function() { | |
return basket.length; | |
}, | |
getTotal: function(){ |
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
XStream xstream = new XStream(); | |
// http://stackoverflow.com/questions/3136234/xstream-root-as-a-collection-of-objects/3138114#3138114 | |
xstream.alias("products", List.class); | |
xstream.alias("product", Product.class); | |
xstream.useAttributeFor(Product.class, "id"); | |
List<Product> ps = (List<Product>)xstream.fromXML("<products><product id=\"1\"><name>Gatti</name><descriptionShort>Pelosi e caldi</descriptionShort></product><product id=\"2\"><name>Cani</name><descriptionShort>Abbaiano</descriptionShort></product></products>"); | |
Iterator<Product> i = ps.iterator(); | |
while (i.hasNext()) { |
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
import org.apache.http.*; | |
import org.apache.http.util.*; | |
import org.apache.http.client.*; | |
import org.apache.http.client.methods.*; | |
import org.apache.http.impl.client.*; | |
protected HttpResponse doPost() throws java.io.IOException { | |
HttpClient client = new DefaultHttpClient(); |
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 get_hmac() { | |
message=$1 | |
shared_key=$2 | |
echo -n "$message" | openssl dgst -md5 -hmac "${shared_key}" | |
} |
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
byte[] messageDigest = algorithm(); | |
StringBuffer hexString = new StringBuffer(); | |
for (int i=0;i<messageDigest.length;i++) { | |
hexString.append(Integer.toHexString(0xFF & messageDigest[i])); | |
} | |
return hexString.toString(); |
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.example.android; | |
import android.content.Context; | |
import android.widget.ImageView; | |
import android.util.AttributeSet; | |
import android.content.res.TypedArray; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.view.animation.AnimationUtils; | |
import android.view.animation.Animation; |
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
/* | |
* http://gstreamer-devel.966125.n4.nabble.com/How-to-concatenate-video-files-td967232.html | |
* $ gcc `pkg-config --cflags --libs gstreamer-0.10` compose.c -o gst_compose | |
*/ | |
#include <stdio.h> | |
//#include <tchar.h> | |
#include <gst/gst.h> | |
GstElement *pipeline, *conv, *sink, *comp; |