Skip to content

Instantly share code, notes, and snippets.

View knowbody's full-sized avatar
🏠
Yolo.

Mateusz Zatorski knowbody

🏠
Yolo.
View GitHub Profile
@knowbody
knowbody / ReverseString.java
Created March 11, 2013 20:55
Reverse String algorithm
import javax.swing.JOptionPane;
public class ReverseString {
public static String reverse(String s) {
int length = s.length(), last = length - 1;
char[] chars = s.toCharArray();
for (int i = 0; i < length / 2; i++) {
char c = chars[i];
chars[i] = chars[last - i];
@knowbody
knowbody / DatabaseInJTable.java
Created March 12, 2013 00:55
Connecting Java with MS Access Database: 1. Click START >>> Control Panel >>> Administrative Tools >>> ODBC Data Sources (32-bit) IMPORTANT: if your Java version is 32-bit you use 32-bit ODBC Data Sources if 64-bit than 64-bit ODBC Data Sources \\\\\ 2. Go to 'System DSN' tab and click 'Add' button and then select the driver Microsoft Access Dri…
import java.awt.BorderLayout;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JPanel;
@knowbody
knowbody / BestFit.cs
Created March 9, 2014 22:35
Memory placement in OS: BestFit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BestFit
{
class Algo
{
@knowbody
knowbody / WorstFit.cs
Created March 9, 2014 22:36
Memory placement in OS: WorstFit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WorstFit
{
class Algo
{
@knowbody
knowbody / FirstFit.cs
Created March 9, 2014 22:37
Memory placement in OS: FirstFit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FirstFit
{
class Algo
{
@knowbody
knowbody / NextFit.cs
Created March 9, 2014 22:37
Memory placement in OS: NextFit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NextFit
{
class Algo
{
@knowbody
knowbody / ruby_setup_mac
Last active August 29, 2015 14:11
ruby macosx setup
http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
@knowbody
knowbody / clickOutside.js
Created November 4, 2015 16:10
React onClickOutside
componentDidMount() {
document.body.addEventListener('click', this.handleBodyClick);
}
componentWillUnmount() {
document.body.removeEventListener('click', this.handleBodyClick);
}
handleBodyClick(e) {
const area = this.refs.item.getDOMNode();
@knowbody
knowbody / router.js
Created November 12, 2015 12:32
stuff
import React, { PropTypes, Component, ContextTypes } from 'react'
import createBrowserHistory from 'history/lib/createBrowserHistory'
import { Router, Route, Link, IndexRoute, Redirect } from 'react-router'
const Navigation = (props, context) => {
let inboxSubmenu = null
if (location.pathname.indexOf('/inbox') !== -1) {
inboxSubmenu = (
<ul>
<li><Link to='/inbox/sent'>Sent</Link></li>
@knowbody
knowbody / .nvimrc
Last active December 11, 2015 17:12
My Neovim config
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required