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
/* | |
* Handler for reset button that cleans all form fields and submits form | |
* See http://www.javascript-coder.com/javascript-form/javascript-reset-form.phtml | |
*/ | |
$('.js-reset-closest-form').click(function() { | |
var form = $(this).closest('form')[0]; | |
/* it's important to take form.elements, not just $(form).find(input) | |
* because inputs can be OUTSIDE <form> tag, i.g.: | |
* <form id="search-form"> ... </form> | |
* ... |
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>Document</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<style> | |
[data-toggle="collapse"][aria-expanded="true"] > .js-rotate-if-collapsed | |
{ | |
-webkit-transform: rotate(180deg); |
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 | |
/* | |
PsySh config file (see http://psysh.org/#configure) | |
!!! | |
Copy this file to ~\.config\psysh\config.php, where ~ is your home dir | |
for example (Windows): C:\Users\MY_USER\.config\psysh\config.php | |
Result dump will look like http://www.qopy.me/D6R2fYEQSw6wjV7NDaPMxw | |
*/ | |
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 "ROOT_DIR=E:\code\knowstory" | |
set "VIRTUAL_ENV=%ROOT_DIR%\env" | |
if defined _OLD_VIRTUAL_PROMPT ( | |
set "PROMPT=%_OLD_VIRTUAL_PROMPT%" | |
) else (#!E:\Python\python.exe | |
import re | |
import sys |
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
def truncate_db(engine): | |
# delete all table data (but keep tables) | |
# we do cleanup before test 'cause if previous test errored, | |
# DB can contain dust | |
meta = MetaData(bind=engine, reflect=True) | |
con = engine.connect() | |
trans = con.begin() | |
con.execute('SET FOREIGN_KEY_CHECKS = 0;') | |
for table in meta.sorted_tables: | |
con.execute(table.delete()) |
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 | |
/* Returns all properties og object including private/protected | |
* in [prop => value] array | |
*/ | |
function props($obj) { | |
$reflect = new \ReflectionClass($obj); | |
$props = $reflect->getProperties(); | |
$result = []; | |
foreach ($props as $prop) { |
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 | |
/* | |
PsySh config file (see http://psysh.org/#configure) | |
!!! | |
Copy this file to ~\.config\psysh\config.php, where ~ is your home dir | |
for example (Windows): C:\Users\MY_USER\.config\psysh\config.php | |
Result dump will look like http://www.qopy.me/D6R2fYEQSw6wjV7NDaPMxw | |
*/ | |
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
-- -------------------------------------------------------- | |
-- Host: 127.0.0.1 | |
-- Server version: 10.1.8-MariaDB - mariadb.org binary distribution | |
-- Server OS: Win32 | |
-- HeidiSQL Version: 9.3.0.4984 | |
-- -------------------------------------------------------- | |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
/*!40101 SET NAMES utf8mb4 */; | |
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; |
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 re | |
from cgi import escape | |
def index(environ, start_response): | |
"""This function will be mounted on "/" and display a link | |
to the hello world page.""" | |
start_response('200 OK', [('Content-Type', 'text/html')]) | |
return ['''Hello World Application | |
This is the Hello World application: |
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
''' | |
code is taken from | |
https://github.com/GoogleCloudPlatform/storage-file-transfer-json-python | |
''' | |
from server.settings import current_environment as env | |
from server.errors import InternalError | |
import httplib2 | |
from apiclient.discovery import build as discovery_build | |
from oauth2client.file import Storage as CredentialStorage |