Skip to content

Instantly share code, notes, and snippets.

" Use Vim settings, rather then Vi settings. This setting must be as early as
" possible, as it has side effects.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@pgdaniel
pgdaniel / RandomPossessions.m
Created July 23, 2014 03:01
random possessions objc
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableArray *items = [[NSMutableArray alloc] init];
[items addObject:@"One"];
[items addObject:@"Two"];
[items addObject:@"Three"];
[items addObject:@"Four"];
@pgdaniel
pgdaniel / Entry
Created July 27, 2014 01:28
craig
class window.EntryDate
@entryDate: null
@startTime: null
constructor:(entryDate) ->
@entryDate = +new Date() / 1000 unless entryDate?
@startTime = entryDate
@pgdaniel
pgdaniel / simple_util.rb
Created August 1, 2014 23:39
my fun spinner
module SimpleUtil
# Simple class to show status via stdout on really long rake tasks
class Spinner
attr_accessor :position
def initialize
@position = 0
@status_marker = ['|', '/', '-', '\\']
$stdout.sync = true
end
using terms from application "Messages"
# The following are unused but need to be defined to avoid an error
on message sent theMessage with eventDescription
end message sent
on message received theMessage with eventDescription
end message received
on chat room message received with eventDescription
@pgdaniel
pgdaniel / _breadcrumbs.html.erb
Created March 15, 2016 08:44
cheap breadcrumb view helper to use with wicked wizard and bootstrap (for laters)
<ol class="breadcrumb">
<%= generate_breadcrumbs %>
</ol>
@pgdaniel
pgdaniel / ruby_rm_updater.sh
Last active March 5, 2019 19:56
Update system
#sudo find . -iname *.rb -exec rm '{}' \;
@pgdaniel
pgdaniel / wget.txt
Last active March 8, 2019 23:45
wget download
wget -e robots=off --mirror --convert-links --adjust-extension --page-requisites --no-parent <site to mirror>
@pgdaniel
pgdaniel / protocol.rb
Created November 19, 2019 05:55 — forked from omnisis/protocol.rb
Ruby UDP Server/Client Pair with Custom Binary Protocol
require 'bindata'
class CustomProtocol < BinData::Record
endian :big
stringz :command_word
uint8 :op1
uint8 :op2
end
@pgdaniel
pgdaniel / protocol.rb
Created November 19, 2019 05:57
Binary TCP Ruby server (inspired from ...)
require 'bindata'
class CustomProtocol < BinData::Record
endian :big
stringz :command_word
uint32 :op1
uint32 :op2
end