View pre-commit
#!/bin/sh
#
# This updates the GitCommit field of the DESCRIPTION file with the git commit
# sha (and branch). You should commit before building to make sure yours line up.
# Then going to that sha will give you that version of the package.
#
# It goes in ~/phd/.git/modules/rphd/hooks (or if not a submodule, in .git/hooks)
#echo $(pwd) ~/phd/rphd
BRANCH=$(git rev-parse --abbrev-ref --verify HEAD )
View blogger-to-jekyll.rb
#!/usr/bin/ruby
# convert posts from httrack of blogger/blogspot to jekyll format
# run from top folder.
require 'nokogiri'
require 'reverse_markdown'
require 'fileutils'
require 'date'
OUT_DIR = '_posts'
View chapter.hs
#!/usr/bin/env runhaskell
-- Filter that adds the metadata block as h1, h2, h3 (title, author, date).
--
-- Usage::
-- chmod +x ./chapter.hs
--
-- # (where each chapter is in its own md file and I want to compile them
-- # into one document preserving the title/author/date for each chapter):
--
-- for f in Chapter*.md; do \
View README.md
View autocaption_knitr.r
# Include the following in a chunk up the top of your document
# Then in your plot chunk, use 'fig.cap=cap()'.
# Set the title of your ggplot via `labs(title="mytitle")`, and
# it will automatically be substituted into the chunk options
# as 'fig.cap'
library(knitr)
opts_knit$set(eval.after='fig.cap')
cap <- function () {
p <- last_plot()
if (!is.null(p) && !is.null(p$labels$title)) {
View knit2
library(knitr)
#' Knits a Rmd to a pdf or HTML
#'
#' In the case of output='html', you may as well just use `knit2html`
#' (although this doesn't clutter your workspace with the intermediate
#' outputs like the .md file).
#'
#' In the case of output='pdf', we knit the Rmd to md (markdown) and then
#' use `pandoc` to convert to PDF.
View test-that-extras.r
# This file has a set of extra tests, expectations and structures extending
# the excellent testthat package[1].
#
# I suggest you read Hadley's introductory article[2] to become acquainted
# with testthat.
#
# THIS IS NOT A POLISHED PRODUCT.
#
# Helpful functions provided
# - describe : almost the same as a context, for grouping tests
View gist:4385143
On 19/12/12 07:46, Stefano Ciancio wrote:
> is possible to launch an empathy chat window from an extension in gnome 3.6?
Yes, request a Telepathy text channel (and make Empathy be the preferred
Handler, if you want).
examples/client/python/ensure-channel.py in the telepathy-glib source
tree is something similar, but in Python. The important bits are that it:
* gets an Account object from the AccountManager (in a Shell extension
View 3.2_3.4_icon_in_notification.js
/** GNOME 3.2 and 3.4: sending a notification to the user.
* In this example we provide the Source's icon through the notification rather than the source
* (note the 'icon:' property in the object provided as the fourth parameter to the Notification.)
*/
// 1. Make a source
let source = new MessageTray.Source("source title");
// 2. Make a notification
let notification = new MessageTray.Notification(source,
"notification title",
"notification message",
View popupDoubleSliderMenuItem.js
/* A SliderMenuItem with two slidable things, for
* selecting a range. Basically a modified PopupSliderMenuItem.
* It has no scroll or key-press event as it's hard to tell which
* blob the user meant to scroll.
*/
function PopupDoubleSliderMenuItem() {
this._init.apply(this, arguments);
}
PopupDoubleSliderMenuItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,