Skip to content

Instantly share code, notes, and snippets.

View tungd's full-sized avatar
🐳
Back to normal

Tung Dao tungd

🐳
Back to normal
View GitHub Profile
@tungd
tungd / neocomplecache-snipmate.diff
Created March 5, 2011 16:06
Fix tab completion with Neocomplecache and SnipMate
diff --git a/plugin/snipMate.vim b/plugin/snipMate.vim
index ef03b12..b1738c6 100644
--- a/plugin/snipMate.vim
+++ b/plugin/snipMate.vim
@@ -159,8 +159,10 @@ fun! TriggerSnippet()
if exists('SuperTabKey')
call feedkeys(SuperTabKey) | return ''
endif
- call feedkeys("\<esc>a", 'n') " Close completion menu
- call feedkeys("\<tab>") | return ''
@tungd
tungd / extras_templatetags.py
Created September 1, 2011 16:33
Sample Cactus template tags support
from django import template
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
# pip install markdown
from markdown import markdown
register = template.Library()
class MarkdownNode(template.Node):
@tungd
tungd / symbol_table.c
Created September 20, 2011 13:35
Symbol table example
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LEN 80
#define INIT_SIZE 30
typedef struct Entry {
void* key;
void* value;
@tungd
tungd / tkgate_install.sh
Created October 20, 2011 16:10
Install TkGate 2.0 on Ubuntu
#!/bin/bash
sudo apt-get install build-essential autotools-dev tcl8.5-dev tk8.5-dev
cd $HOME
mkdir build && cd build
wget ftp://gadoid.ices.cmu.edu/pub/tkgate/pre-release/tkgate-2.0-b10.tar.gz
tar xvzf tkgate-2.0-b10.tar.gz
cd tkgate-2.0-b10/
./configure
make
# Only if you want to install
@tungd
tungd / snippets_complete.diff
Created November 4, 2011 13:29
Fix neocomplcache snippet expand when gdefault is set
diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim
index f229823..87e9cc7 100644
--- a/autoload/neocomplcache/sources/snippets_complete.vim
+++ b/autoload/neocomplcache/sources/snippets_complete.vim
@@ -528,7 +528,11 @@ function! s:expand_newline()"{{{
while match >= 0
let end = getline('.')[matchend(getline('.'), '<\\n>') :]
" Substitute CR.
- silent! s/<\\n>//
+ if &gdefault
@tungd
tungd / ch.vim
Created November 11, 2011 15:55
vim-ref ch source
" A ref source for ch. https://github.com/visionmedia/ch
" Version: 0.0.1
" Heavily based on man source by:
" Author : thinca <[email protected]>
let s:save_cpo = &cpo
set cpo&vim
scriptencoding utf-8
@tungd
tungd / AATest.java
Created November 30, 2011 16:46
Antialias function plotting test
package com.tungd;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Line2D;
import java.awt.geom.QuadCurve2D;
import javax.swing.JFrame;
@tungd
tungd / ri.vim
Created December 18, 2011 16:42
vim-ref ri source
" A ref source for ri.
" Version: 0.0.1
" Author : Tung Dao <[email protected]>
" Modified from pman source by soh335 <[email protected]>
" https://github.com/soh335/vim-ref-pman
" License: Creative Commons Attribution 2.1 Japan License
" <http://creativecommons.org/licenses/by/2.1/jp/deed.en>
let s:save_cpo = &cpo
set cpo&vim
@tungd
tungd / vietnamese-telex_utf-8.vim
Created March 19, 2012 17:07
Vietnamese TELEX keymap for vim
" Vim Keymap file for vietnamese through the Telex method
" Maintainer: Tung Dao <[email protected]>
" Last Change: 30 Aug 2011
scriptencoding utf-8
let b:keymap_name = "vietnamese"
loadkeymap
a a
@tungd
tungd / mips_learn.vim
Created March 21, 2012 08:51
Functions I used to learn Assembly language on MIPS Architecture
" Author: Tung Dao <[email protected]>
" Usage: compile .c file, load generated .s file in vim,
" source this script and execute the function.
" Requires xgcc executable which comes with MipsIT
" Ex: xgcc -O3 -S -c foo.c
" vim foo.s
" In vim:
" so ~/Desktop/mips_learn.vim
" call ToMIPS()