Skip to content

Instantly share code, notes, and snippets.

@hkan
hkan / MigrateAutoCommand.php
Last active Dec 30, 2015
Laravel Artisan Auto Migration Command
View MigrateAutoCommand.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class InstallCommand extends Command {
/**
* The console command name.
@hkan
hkan / README.md
Last active Aug 29, 2015
Filter Out Empty Strings of Array
View README.md

Filter Empty Values

Returns a new array without the empty strings.

Usage

var myArray = [ "hakan", "", "0", 0, false ];

myArray = myArray.filterEmpty();
@hkan
hkan / getDotNotated
Created Jun 13, 2014
Object Prototype
View getDotNotated
Object.defineProperty(Object.prototype, "getDotNotated", {
value: function (dotNotation) {
var arrayOfNames = dotNotation.split('.');
var tmp = this;
for (var i in arrayOfNames) {
if (arrayOfNames.hasOwnProperty(i)) {
tmp = tmp[arrayOfNames[i]];
}
}
@hkan
hkan / setDotNotated
Created Jun 13, 2014
Object Prototype
View setDotNotated
Object.defineProperty(Object.prototype, "setDotNotated", {
value: function (dotNotation, value) {
var arrayOfNames = dotNotation.split('.');
var last = arrayOfNames.pop();
var tmp = this;
for (var i in arrayOfNames) {
if (!arrayOfNames.hasOwnProperty(i))
continue;
@hkan
hkan / composers.php
Last active Nov 6, 2015
Reproduce routes for other languages in the application. (Laravel 4)
View composers.php
// I composed them into my layout file
View::composer('layout', function($view)
{
// Current route object
$route = Route::getCurrentRoute();
// Take out first part of route (the locale key)
$routeWithoutLang = implode('.', array_slice(explode('.', $route->getName()), 1));
// You should probably put this in a foreach loop
@hkan
hkan / remove-dotted-border-from-focus-in-firefox.css
Created Nov 6, 2015
Firefox'taki *dotted border* problemini çözen hede
View remove-dotted-border-from-focus-in-firefox.css
:focus, :active {
outline: 0 !important;
}
@hkan
hkan / app__Console__Commands__CheckSessionForNodeSocket.php
Last active May 18, 2016
Socket.io + Laravel 5.1 (Late edit: This is shit. Do not use. Use JWT instead.)
View app__Console__Commands__CheckSessionForNodeSocket.php
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
class CheckSessionForNodeSocket extends Command
{
/**
@hkan
hkan / SomeComponent.vue
Last active May 18, 2016
[Socket.io] Define events and connect later at will
View SomeComponent.vue
<template>
<div class="some-class">
{{ someVariable }}
</div>
</template>
<script>
export default {
data() {
return {
@hkan
hkan / light.css
Last active Apr 18, 2018
Light content theme for indiehackers.com
View light.css
html {
background: #f5f5f5;
}
/* CONTENT PAGE */
.forum .forum-thread {
background: none;
}
@hkan
hkan / whatsapp-web-emoji-keywords.txt
Created Apr 30, 2018
Emoji shortcut keywords for Whatsapp Web
View whatsapp-web-emoji-keywords.txt
0⃣ 0, keycap, zero
1⃣ 1, number, one
🕜 1, 30, clock, time, one, thirty, 1:30, one-thirty
🕐 1, clock, time, one, 00, o’clock, 1:00, one o’clock
2⃣ 2, number, two
🕝 2, 30, clock, time, two, thirty, 2:30, two-thirty
🕑 2, clock, time, two, 00, o’clock, 2:00, two o’clock
3⃣ 3, keycap, three
🕞 3, 30, three, clock, time, thirty, 3:30, three-thirty
🕒 3, three, clock, time, 00, o’clock, 3:00, three o’clock