Skip to content

Instantly share code, notes, and snippets.

@yurenju
yurenju / gist:1086042
Created July 16, 2011 05:32
generate html
csv = open('coscup.csv')
html = open('album.html', 'w')
style = 'width:600px;margin-bottom:50px;';
style += 'margin-left:auto;margin-right:auto;'
style += 'border: 1px solid #AAA;padding:10px;'
style += '-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);'
for line in csv.readlines():
if 'Timestamp' in line:
continue
@yurenju
yurenju / gist:2943291
Created June 17, 2012 03:24
SampleClient
package idv.yurenju.google.sample;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.json.JsonHttpClient;
import com.google.api.client.json.JsonFactory;
public class SampleClient extends JsonHttpClient {
public static final String DEFAULT_BASE_URL = "https://api.twitter.com/";
@yurenju
yurenju / gist:3057720
Created July 6, 2012 02:35
GetJsonPropertyName
string GetJsonPropertyName(User user)
{
Type type = user.GetType();
var objProps = type.GetProperties();
foreach (var prop in user.GetType().GetProperties())
{
var attrs =
from attr in Attribute.GetCustomAttributes(prop)
where attr is JsonPropertyAttribute
select attr;
#!/usr/bin/env python
orig = open('coscup.log')
output = open('coscup.txt', 'w')
for line in orig.readlines():
hour = (8 + int(line[0:2], 10)) % 24
output.write(str(hour).zfill(2) + line[2:])
orig.close()
output.close()
@yurenju
yurenju / gist:3774234
Created September 24, 2012 04:52
一次把目錄裏面的 SVG 轉成寬度 128px 的 PNG
#!/bin/bash
for f in `ls *.svg`; do
inkscape -w 128 -f "$f" -e "PNG_DIR/${f%.*}.png"
done
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>
<button>click me</button>
<script type="text/javascript">
document.querySelector('button').addEventListener('click', function() {
new MozActivity({
name: 'save-bookmark',
$ gaiatest --address=localhost:2828 test_gallery.py
starting httpd
running webserver on http://10.247.27.65:39211/
TEST-START test_gallery.py
test_gallery_view (test_gallery.TestGallery) ... ERROR
======================================================================
ERROR: test_gallery_view (test_gallery.TestGallery)
----------------------------------------------------------------------
Traceback (most recent call last):
function(ssid) {
var manager = window.navigator.mozWifiManager;
var req = manager.getNetworks();
req.onsuccess = function onScanSuccess() {
var networks = req.result;
for (var i = 0; i < networks.length; i++) {
if (networks[i].ssid === ssid) {
manager.associate(networks[i]);
}
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from gaiatest import GaiaTestCase
import time
import unittest
class TestBrowser(GaiaTestCase):
from gaiatest import GaiaTestCase
import time
import unittest
class TestInstallApps(GaiaTestCase):
manifests = ['http://pasjans-online.pl/manifest.webapp',
'http://moz.galactians.spacemonsters.co.uk/manifest.webapp',
'http://app-6-mwa-vc-as-en.jocly.com/jocly.webapp',