Skip to content

Instantly share code, notes, and snippets.

View jesperbjensen's full-sized avatar

Jesper Blad Jensen jesperbjensen

View GitHub Profile
@jesperbjensen
jesperbjensen / terminal.txt
Created August 10, 2011 10:44
Terminal Cheatcheet
tail -f [filename]
- shows the last lines of a file. The -f options makes it stay open, reload the file
rm -R [folder]
- removes a folder and it's content
Using Vim settings from https://github.com/carlhuda/janus
:ls List open buffers
Ctrl+w c Closes the current window
o Begin a new line below the current one
:/searchterm Searches for the search word. Use n and N to move back
and forth
:map KEY COMMAND Creates a new command. Use <Leader> to choose the leader
key and <Enter> to execute it, for exsample.
H or M or L Moves to the first, middle or last line on screen.
@jesperbjensen
jesperbjensen / twitrotator.html
Created April 28, 2011 15:46
Simple tweet rotator
<!DOCTYPE html>
<html>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
</script>
<script type="text/javascript" charset="utf-8">
var query = 'javascript';
$(function() {
$.getJSON("http://search.twitter.com/search.json?callback=?&q=" + query,
@jesperbjensen
jesperbjensen / gist:939402
Created April 24, 2011 08:22
A little TextMate command for linking the current project up to Pow
# Links the current project to Pow: http://pow.cx
cd ~/.pow
ln -s $TM_PROJECT_DIRECTORY
echo "<p><strong>Done</strong></p>"
@jesperbjensen
jesperbjensen / FillWith.vb
Created April 5, 2011 06:46
A nice extension method that maps properties from one type to another
<Extension()> _
Public Sub FillWith(ByVal destination As Object, ByVal source As Object, ByVal ParamArray ignoredProps() As String)
Dim sourceType = source.GetType()
Dim props As New Dictionary(Of String, String)
For Each prop As String In ignoredProps
props.Add(prop, prop)
Next
For Each objProperty In destination.GetType().GetProperties()
@jesperbjensen
jesperbjensen / CommaSeperate.vb
Created April 5, 2011 06:44
A nice extension method that lets you comma seperate anything
<Extension()> _
Public Function CommaSeperate(Of T)(ByVal lstList As IEnumerable(Of T), ByVal delFunction As Func(Of T, String), ByVal strDelimiter As String) As String
Dim builder As New StringBuilder
For Each item As T In lstList
If delFunction IsNot Nothing Then
builder.Append(delFunction(item) & strDelimiter)
Else
builder.Append(item.ToString() & strDelimiter)
End If
Next