This is a common case in django ORM.
from django.db import models
class Author(models.Model):| DELIMITER $$ | |
| CREATE DEFINER=`root`@`localhost` FUNCTION `COMPARE_STRING`( s1 text, s2 text) RETURNS int(11) | |
| DETERMINISTIC | |
| BEGIN | |
| DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT; | |
| DECLARE s1_char CHAR; | |
| DECLARE cv0, cv1 text; | |
| SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0; | |
| IF s1 = s2 THEN | |
| RETURN 0; |
| Apple removed colored sub-pixel antialiasing in MacOS Mojave | |
| (https://developer.apple.com/videos/play/wwdc2018/209/ starting from ~28min) | |
| To make fonts look normal in Sublime Text, add to Preferences: | |
| // For the editor | |
| "font_options": [ "gray_antialias" ], | |
| // For the sidebar / other elements | |
| "theme_font_options": [ "gray_antialias" ], |
| #!/usr/bin/env python | |
| # -*- encoding: utf-8 -*- | |
| # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: | |
| # Author: Binux<[email protected]> | |
| # http://binux.me | |
| # Created on 2013-03-02 20:47:08 | |
| import os | |
| import re | |
| import sys |
| #!/bin/bash | |
| # Might as well ask for password up-front, right? | |
| sudo -v | |
| # Keep-alive: update existing sudo time stamp if set, otherwise do nothing. | |
| while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
| # Example: do stuff over the next 30+ mins that requires sudo here or there. | |
| function wait() { |
| // Ever needed to escape '\n' as '\\n'? This function does that for any character, | |
| // using hex and/or Unicode escape sequences (whichever are shortest). | |
| // Demo: http://mothereff.in/js-escapes | |
| function unicodeEscape(str) { | |
| return str.replace(/[\s\S]/g, function(character) { | |
| var escape = character.charCodeAt().toString(16), | |
| longhand = escape.length > 2; | |
| return '\\' + (longhand ? 'u' : 'x') + ('0000' + escape).slice(longhand ? -4 : -2); | |
| }); | |
| } |