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 | |
// in app/Providers/AppServiceProvider | |
/*namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{*/ | |
public function boot() | |
{ | |
if (\App::environment('local')) { | |
\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) { |
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
class UserProduct(Base): | |
user_id = Column(BigInteger, ForeignKey('user.user_id'), | |
primary_key=True) | |
product_id = Column(BigInteger, ForeignKey('product.product_id'), | |
primary_key=True) | |
class Product(Base): | |
product_id = Column(BigInteger, primary_key=True) |
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
import time | |
from timeout import timeout | |
class Test(object): | |
@timeout(2) | |
def test_a(self, foo, bar): | |
print foo | |
time.sleep(1) | |
print bar | |
return 'A Done' |
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
Show hidden characters
[ | |
{ "keys": ["alt+shift+f"], "command": "reindent" }, | |
{ "keys": ["ctrl+alt+s"], "command": "toggle_side_bar" }, | |
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }, | |
{"keys": [ "ctrl+alt+z" ], "command": "insert_snippet", "args": { "name": "Packages/User/my-snippets/localize.sublime-snippet"} }, | |
] |
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
@echo off | |
set "VIRTUAL_ENV=E:\Web.LOCAL\Python\projects\knowstory\env" | |
set "ROOT_DIR=E:\Web.LOCAL\Python\projects\knowstory" | |
if defined _OLD_VIRTUAL_PROMPT ( | |
set "PROMPT=%_OLD_VIRTUAL_PROMPT%" | |
) else ( | |
if not defined PROMPT ( | |
set "PROMPT=$P$G" | |
) |
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
{ | |
"require": { | |
"illuminate/validation": "~4.2.9" | |
}, | |
} |
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
// checks that all files in <input type="file"> have valid mime type (according to 'accept' attribute) | |
$.fn.filesHaveValidType = function() { | |
// this validation works for: | |
// 1. simple 'accept' values like 'image/*' | |
// 2. combined 'accept' values like accept="image/png, audio/mp3" | |
var elem = this[0]; | |
var accept = this.attr('accept'); | |
if (accept) { | |
var acceptTypes = accept.split(',').map(function(s) { return s.trim() }); | |
// iterate over all files and return false if some file is of invalid type |
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
/* Grid system */ | |
* { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
.container:after, .container:before, .row:after, .row:before { | |
content: " "; display: table; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>My project</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<style type="text/css"> | |
.navbar-avatar { | |
padding-top: 7px !important; | |
padding-bottom: 7px !important; |
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
<iframe width="100%" height="300" src="//jsfiddle.net/aPv9H/626/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe> |