Skip to content

Instantly share code, notes, and snippets.

View haldun's full-sized avatar

Haldun Bayhantopcu haldun

  • Berlin, Germany
View GitHub Profile
@haldun
haldun / gist:48b0c7bd60cf2de4ff44
Created March 19, 2015 17:11
Random extension for UIColor
extension UIColor {
class func random() -> UIColor {
let r: CGFloat = CGFloat(drand48())
let g: CGFloat = CGFloat(drand48())
let b: CGFloat = CGFloat(drand48())
return UIColor(red: r, green: g, blue: b, alpha: 1)
}
}
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
class Response {
protected String message;
protected int status;
public String getMessage() {
return message;
}
package fazlamesai.com.myapplication;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
package main
import (
"encoding/json"
"net/http"
"strings"
)
func main() {
http.HandleFunc("/weather/", func(w http.ResponseWriter, r *http.Request) {
@haldun
haldun / summarize.py
Last active August 29, 2015 14:12 — forked from rodricios/summarize.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
@haldun
haldun / gist:c53fbf4c0011e3c1700e
Created October 21, 2014 16:09
my json experiments
// Playground - noun: a place where people can play
import UIKit
// Data -> JSON?
// JSON -> Cafe?
enum JSONValue {
case JSONObject([String:JSONValue])
case JSONArray([JSONValue])
@haldun
haldun / gist:361aa0c1ff7bfa060e5a
Created May 29, 2014 12:55
video tag for angular
.directive('fmVideo', function() {
var clearContainer = function(element) {
element.find('video').each(function(_, el) {
el.pause();
el.src = "";
});
element.empty();
};
return {
@haldun
haldun / gist:048ea38c69dadcb1eec4
Last active August 29, 2015 14:00
move sprite by touch
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
if (self.fingerIsOnWheel) {
CGPoint touchLocation = [touch locationInNode:self];
CGPoint previousLocation = [touch previousLocationInNode:self];
CGFloat angle1 = [self angleBetweenFirstPoint:previousLocation secondPoint:CGPointZero];
CGFloat angle2 = [self angleBetweenFirstPoint:touchLocation secondPoint:CGPointZero];
CGFloat bearingRadians = angle2 - angle1;
@haldun
haldun / gist:11197135
Created April 22, 2014 22:53
template experiments
//
// main.cpp
// CppDatabase
//
// Created by Haldun Bayhantopcu on 23/04/14.
// Copyright (c) 2014 Monoid. All rights reserved.
//
#include <iostream>
#include <memory>
@haldun
haldun / gist:10498377
Created April 11, 2014 20:20
remote proxy
ssh -f -N -R 3000:127.0.0.1:3000 hb@