This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Cache; | |
class CacheOrRetrieve | |
{ | |
private $cacheTime = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generates slug with n characters that matches /[A-Za-z0-9]+/ | |
def generate_slug(n = 7) | |
[*('A'..'Z'), *('a'..'z'), *('0'..'9')].shuffle[0,n].join | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takes argument and makes sure that filtered object has attribute with that name set to true | |
app.filter('attribute', function() { | |
return function(input, argument) { | |
var output = []; | |
if (argument == '') { | |
return input; | |
} | |
for (i in input) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector(".bold").addEventListener('click', addBold, false); | |
ta = document.querySelector("textarea[name='content']"); | |
function addBold() { | |
surroundInTextarea(ta, '**'); | |
return false; | |
} | |
function typeInTextarea(el, newText) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var offset = 60; | |
$("a[href*=#]:not([href=#])").click(function() { | |
if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") || location.hostname == this.hostname) { | |
var t = $(this.hash); | |
if (t = t.length ? t : $("[name=" + this.hash.slice(1) + "]"), t.length) | |
return $("html,body").animate( {scrollTop: t.offset().top - offset}, 1e3), !1 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let password_field = document.querySelector("#user_password") | |
let password_revealer = document.querySelector("#user_password_revealer") | |
password_revealer.addEventListener("click", function(e) { | |
if (password_revealer.checked) { | |
password_field.type = "text" | |
} else { | |
password_field.type = "password" | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Plugins | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'elixir-lang/vim-elixir' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// stack.c | |
// | |
// Created by Adam Gavlák on 26/09/16. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div | |
padding: 10px | |
@include for-size(desktop-up) | |
padding: 20px |
OlderNewer