Skip to content

Instantly share code, notes, and snippets.

View DarrylDias's full-sized avatar
🎯
Focusing

Darryl Dias DarrylDias

🎯
Focusing
View GitHub Profile
@DarrylDias
DarrylDias / .bash_profile
Last active August 29, 2015 13:56
Ruby 2.1 export environment. [Arch Linux]
PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
export PATH
@DarrylDias
DarrylDias / nginx-startup.sh
Created February 8, 2014 16:50
NGINX startup script for user who have source complied NGINX.
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
var net = require('net'); // Store net module in net variable
var server = net.createServer(function (socket) { // create a netserver using createServer() function.
socket.write('Information \r\n'); // Write information of the client.
socket.pipe(socket); // connect to socket
});
server.listen(1337, '127.0.0.1'); // port and host running on.
@DarrylDias
DarrylDias / pdodriver.php
Created March 28, 2014 17:32
Check for available drivers for Database in PDO PHP.
<?php
print_r(PDO::getAvailableDrivers()); // This will display an array that lists PDO drivers avilable on the web server.
?>
/*
Example.
Web Setup: WAMP.
@DarrylDias
DarrylDias / phpversion.php
Created April 1, 2014 12:29
Display PHP version information.
<?php
echo PHP_VERSION;
?>
@DarrylDias
DarrylDias / 256_Bit_bashrc
Created April 26, 2014 06:00
For Vim to enable 256 Bit color in Linux distributions like Ubuntu, Debian.
TERM=xterm-256color #
@DarrylDias
DarrylDias / hello.rb
Created April 26, 2014 06:02
"Hello World!" in Sinatra framework.
require "sinatra/base"
class App < Sinatra::Base
get "/" do
"Hello World!"
end
end
@DarrylDias
DarrylDias / .vimrc.local
Last active August 29, 2015 14:00
vimrc.local
colorscheme molokai
let g:neocomplcache_disable_auto_complete = 1
set nospell
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
function! s:check_back_space()"{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
@DarrylDias
DarrylDias / neovim-test.vim
Created April 26, 2014 16:06
Neovim job control demo Original file: http://pastebin.com/hpiCP9Ae
:let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '9991'])
:let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '9991'])
function JobEvent()
" v:job_data[0] = the job id
" v:job_data[1] = the event type, one of "stdout", "stderr" or "exit"
" v:job_data[2] = data read from stdout or stderr
if v:job_data[1] == 'stdout'
let str = 'Message from job '.v:job_data[0].': '.v:job_data[2]
elseif v:job_data[1] == 'stderr'
@DarrylDias
DarrylDias / hello.php
Created May 1, 2014 11:19
Hello World in HackLang
/*
This is an example of Facebook's HackLang.
*/
<?hh # Hack uses 'hh' insted of 'php'
echo "Hello World!