Skip to content

Instantly share code, notes, and snippets.

View oguzcanhuner's full-sized avatar

Oguz Huner oguzcanhuner

View GitHub Profile
@oguzcanhuner
oguzcanhuner / writing.md
Last active August 29, 2015 14:27
Writing motivation

I've recently started writing a book, something that I've always wanted to do, and this is my attempt at documenting my journey.

Why am I doing it?

I remember the feeling that I had when I finished my university thesis; after a year of intense study, writing and re-writing, I had finally come up with this large body of work bundled nicely together in a binder. Although I was pretty worn out, it felt great that I had actually accomplished the task. Ever since that moment, it's been hard to say that I've actually completed anything.

I suppose that taking on this project is my way of trying to regain that feeling. When you write software for a living, it's hard to actually finish anything. You can certainly write great code, or code that fulfils a certain task, but there's always something to add.

There's also something about writing which makes you question everything about your thought process. I find that I'm most critical of myself when I write my thoughts down, which usually holds me back from fini

@oguzcanhuner
oguzcanhuner / gist:778a5ea5844c34ee0de9
Created July 16, 2015 22:27
creating a coordinate system in ruby
some relevant data structures:
- 2d array
- hash
building a coordinate class
Struct vs PORO - struct is a bit faster
initializing and printing
@oguzcanhuner
oguzcanhuner / 1-post.md
Last active August 29, 2015 14:24
Picking a random hash element

Over the weekend, I was working on optimising some code on a game that I'm working on. The game contains a hash with a million elements which represent each point in a 1000 x 1000 grid, with the key representing a coordinate.

{Coordinate(1,1) => Cell.new, Coordinate(1,2) => Cell.new .. }

I wanted to grab a random grid point, so I figured that I'd just need a random key and find the value for that key:

@map[@map.keys.sample]
Eucalyptus.configure do |config|
config.api_key = ENV['api_key']
end
Eucalyptus::Ad.find(123)
Eucalyptus::Campaign.find(123)
module Eucalyptus
attr_accessor :configurtion
var increment = 1;
var getPosts = function(i){
url = "posts/" + i + ".html";
$.ajax({
url: url,
type: "GET",
success:function(data){
$('#posts').append("<p class='post'>"+data+"</p>");
increment++;
getPosts(increment);
.popout-base-bg.timer-modal-1{style: "#{"display: block;" if show_popup == 1}"}
.popout-base.timer-modal-1{style: "#{"display: block;" if show_popup == 1}"}
.popout-inner
.popout-content
%p.popup-title Like what you see?
%p
Order today using discount code 30MINI and get 30% off - and keep the class for life!
%a.btn.btn-primary#buy-class{href: "#{new_online_activity_enrollment_path(oa)}"}
Claim your discount
%p
Enter some code..
Enter some code..
Enter some code..
class Library
def add_book(book)
end
end
class Book
def initialize(name)
@name = name
end
def name