Skip to content

Instantly share code, notes, and snippets.

View koraysels's full-sized avatar

Koray S. koraysels

View GitHub Profile
@koraysels
koraysels / gist:221a1cbb26ec6b1c4275
Last active August 29, 2015 14:16
get multiple dropbox accounts synced on your mac

create a folder on your hard drive labeled "Dropbox-personal" (or whatever name you want) in your home folder.

then run HOME=$HOME/Dropbox-personal /Applications/Dropbox.app/Contents/MacOS/Dropbox & in your terminal

@koraysels
koraysels / angular-clientcode.js
Created March 4, 2015 17:07
make angular $http behave like jQuery.ajax
var App = angular.module('app', ['ui.bootstrap', 'angularFileUpload'], function ($httpProvider) {
// Use x-www-form-urlencoded Content-Type
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
/**
* The workhorse; converts an object to x-www-form-urlencoded serialization.
* @param {Object} obj
* @return {String}
*/
var param = function (obj) {
@koraysels
koraysels / windowOnload.js
Created February 20, 2015 12:54
the correct way to use window.onload
module.exports = function windowOnLoad(func) {
// pass the function you want to call at 'window.onload', in the function defined above
// assign any pre-defined functions on 'window.onload' to a variable
var oldOnLoad = window.onload;
// if there is not any function hooked to it
if (typeof window.onload != 'function') {
// you can hook your function with it
window.onload = func
} else { // someone already hooked a function
window.onload = function () {
@koraysels
koraysels / functions.php
Last active August 29, 2015 14:15
add categories to your custom post type in wordpress (post type here is 'event')
require_once 'post-types/event.php';
// WP Menu Categories
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
register_taxonomy( 'category', 'event', array(
'hierarchical' => true,
'label' => 'Categorieën',
'query_var' => true,
@koraysels
koraysels / 0_reuse_code.js
Created February 4, 2014 09:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console