Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
| USE [HobbyDB] | |
| GO | |
| /****** Object: Table [dbo].[AspNetRoleClaims] Script Date: 6/4/2018 10:18:03 PM ******/ | |
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AspNetRoleClaims]') AND type in (N'U')) | |
| BEGIN | |
| CREATE TABLE [dbo].[AspNetRoleClaims]( |
Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
| DROP FUNCTION IF EXISTS proper; | |
| SET GLOBAL log_bin_trust_function_creators=TRUE; | |
| DELIMITER | | |
| CREATE FUNCTION proper( str VARCHAR(128) ) | |
| RETURNS VARCHAR(128) | |
| BEGIN | |
| DECLARE c CHAR(1); | |
| DECLARE s VARCHAR(128); | |
| DECLARE i INT DEFAULT 1; | |
| DECLARE bool INT DEFAULT 1; |
| #!/usr/bin/env python | |
| ## Mysql-Python basic examples. | |
| ## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/) | |
| ## Gist created only for quick reference purpose | |
| import sys | |
| import _mysql | |
| import MySQLdb as mdb |