Skip to content

Instantly share code, notes, and snippets.

View bklein01's full-sized avatar

Ben Klein bklein01

View GitHub Profile
@bklein01
bklein01 / create-aspnet-core-identity-schema.sql
Created January 31, 2023 02:03 — forked from akatakritos/create-aspnet-core-identity-schema.sql
Script to create the ASPNET core Identity tables
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](
@bklein01
bklein01 / excerpt.md
Created July 23, 2019 11:15 — forked from stankusl/excerpt.md
Text Excerpt PHP function

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;
@bklein01
bklein01 / mysql.py
Created April 3, 2018 19:27 — forked from naiquevin/mysql.py
Examples of Mysql programming in Python
#!/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