Skip to content

Instantly share code, notes, and snippets.

View aire-con-gas's full-sized avatar

Dave Hong aire-con-gas

View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
/** Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
@aire-con-gas
aire-con-gas / .zshrc
Created January 23, 2015 22:12
My zshell presets
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
@aire-con-gas
aire-con-gas / .vimrc.local
Created January 23, 2015 22:15
local vimrc overrides
set nocursorline " don't highlight current line
" keyboard shortcuts
inoremap jj <ESC>
nmap <F8> :TagbarToggle<CR>
" highlight search
"set hlsearch
"nmap <leader>hl :let @/ = ""<CR>
@aire-con-gas
aire-con-gas / .tmux.conf.local
Created January 23, 2015 22:15
local tmux conf overrides
# Add your local tmux config here
# Copy-paste integration
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
@aire-con-gas
aire-con-gas / in_str.rb
Created February 27, 2015 18:24
Finding substring via brute force solution
def in_str(needle, haystack)
for i in (0..haystack.chars.length - 1)
if needle.chars[0] == haystack.chars[i]
found = true
for j in (0..needle.chars.length - 1)
if needle[j] != haystack[i + j]
found = false
break
end
end
@aire-con-gas
aire-con-gas / text.rb
Last active August 29, 2015 14:16
Text-related activities: reverse text and swap in place
module Bigaqua
module Text
def reverse_text(input)
arr = []
i = input.length - 1
while i >= 0 do
arr.push(input[i])
i -= 1
end
arr.join("")
@aire-con-gas
aire-con-gas / js_exercises.js
Last active December 11, 2017 18:15
Palindrome and Fibonacci
function IsPalindrome(some_txt) {
var text_length = some_txt.length;
var success, j = text_length - 1;
var mid = Math.floor(text_length / 2);
for(var i=0, il=text_length-1; i < il; i++) {
if(some_txt[i] !== some_txt[j]) {
success = false;
break;
} else {
@aire-con-gas
aire-con-gas / trie.rb
Last active August 29, 2015 14:16
Trie struct
# Data structure for a Trie
# should look something like this internally
# {:a => {
# :is_word => true
# :b => {
# :is_word => false
# :a = > {
# :is_word => false
# :c => {
# :is_word => false
/**
* @param {string} s
* @return {boolean}
*/
var canPermutePalindrome = function(s) {
var charTable = {},
charSet = {
'even': 0,
'odd': 0
},