Skip to content

Instantly share code, notes, and snippets.

@yihui
yihui / README.md
Last active June 30, 2021 18:01
Preview all syntax highlighting themes in knitr (HTML and LaTeX)
@timelyportfolio
timelyportfolio / garch in plot.xts panel.r
Created August 17, 2012 21:43
plot.xts and rugarch
#install.packages("xtsExtra", repos="http://R-Forge.R-project.org")
require(quantmod)
require(rugarch)
require(xtsExtra) #if you get an error, see first line and install from r-forge
getSymbols("DEXJPUS",src="FRED")
DEXJPUS<-1/to.weekly(DEXJPUS)
ugarch.panel <- function(index,x,type,cex,col,pch,...){
@thomaspark
thomaspark / bootswatchlet.js
Created August 16, 2012 04:32
Bootswatch bookmarklet
if($('.bootswatcher')[0]){
$('.bootswatcher').remove();
} else {
var $e = $('<select class="bootswatcher"><option>Amelia</option><option>Cerulean</option><option>Cosmo</option><option>Cyborg</option><option>Journal</option><option>Readable</option><option>Simplex</option><option>Slate</option><option>Spacelab</option><option>Spruce</option><option>Superhero</option><option>United</option></select>');
var l = 1 + Math.floor(Math.random() * $e.children().length);
var r = '<link rel="stylesheet" href="http://bootswatch.com/default/bootstrap-responsive.min.css">';
$e.css({'z-index': '99999', 'position': 'fixed', 'top': '5px', 'right': '5px', 'opacity': '0.5'}
).hover(
function(){$(this).css('opacity', '1');},
function(){$(this).css('opacity', '0.5');}
@windix
windix / olympic.rb
Created July 31, 2012 04:21
Olympic Game scraper
require "mechanize"
require "sinatra"
require "stringio"
class MedalScraper
def initialize
@sports = {
'archery' => 'Archery',
'athletics' => 'Athletics',
'badminton' => 'Badminton',
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 7, 2025 23:53
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#Iteration 5
# Once we have pulled our array of followers from Twitter, we can push the data through another API to grab some data. Lets tap into Klout.com- a site that scores the influence of one's social media presence- to see which of our followers are the most infleuncial
#Step 0: requirements
# This iteration requires a rubygem- 'klout' along with an API key
require 'klout'
@k = Klout::API.new('w7cd26nt27pzgy4gj7waruw2') #, {:format => 'xml', :secure => true})
@codingjester
codingjester / upload.php
Created January 20, 2012 22:09
Working PHP example of uploading a photo with V2 api
<?php
#Requires PHP 5.3.0
define("CONSUMER_KEY", "consumer_key");
define("CONSUMER_SECRET", "consumer_secret");
define("OAUTH_TOKEN", "access_token");
define("OAUTH_SECRET", "access_secret");
function oauth_gen($method, $url, $iparams, &$headers) {
@robertknight
robertknight / mendeleydesktop
Created January 13, 2012 11:37
Mendeley Desktop launcher script with GDB
#!/usr/bin/python
import os
import subprocess
import sys
import platform
# Check if this is a 'generic Linux' build (which could be installed anywhere)
# or an Ubuntu/Debian build (installed to /usr/bin/mendeleydesktop
# with other files in /opt/mendeleydesktop)
@jwieringa
jwieringa / vim-ruby-command-t-install.markdown
Created November 8, 2011 16:40
Install Vim with Ruby Interpreter and Command-T on Ubuntu

Summary

The following instructions will install Vim with the Ruby interpreter and Command-T. I keep my vim settings under revision control, thus I have chosen to use Git's submodules and Pathogen to manage Command-T. Depending on your preferences, you may want to setup Command-T differently. I recommend reading through the Command-T Readme

Install dependencies (what my system required), hg, and rake

sudo apt-get install ruby ruby-dev libncurses5-dev mercurial clone build-essential rake

I chose to compile vim with my system Ruby, 1.8.7. It is important that you use the same version to compile both Vim and Command-T. If your using RVM and you want to do the same, before proceeding you will want to:

rvm use system
@hSATAC
hSATAC / 256color.pl
Created July 20, 2011 14:48
256color.pl
#!/usr/bin/perl
# Author: Todd Larason <[email protected]>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {