http://www.git-tower.com/learn
This file contains hidden or 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
public static class HtmlTruncator | |
{ | |
public static string LimitOnWordBoundary(string str, int maxLength, string ellipses = "...") | |
{ | |
XmlDocument doc = new XmlDocument(); | |
XmlParserContext context = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), null, XmlSpace.Preserve); | |
XmlTextReader reader = new XmlTextReader("<xml>" + str + "</xml>", XmlNodeType.Document, context); | |
bool shouldWriteEllipses; |
This file contains hidden or 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
using System.Drawing; | |
using System.Drawing.Drawing2D; | |
using System.Drawing.Imaging; | |
using System.IO; | |
public static class ImageUtil | |
{ | |
public static Image Resize(this Image image, int width, int height) | |
{ | |
var destRect = new Rectangle(0, 0, width, height); |
This file contains hidden or 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>Dummy Page</title> | |
<meta name="description" content="Simple, quick, standalone responsive placeholder Website without any additional resources"> | |
<meta name="author" content="https://gist.github.com/oliveratgithub"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous"> | |
<!--[if lt IE 9]> |
This file contains hidden or 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
function role_exists( $role ) { | |
if( ! empty( $role ) ) { | |
return $GLOBALS['wp_roles']->is_role( $role ); | |
} | |
return false; | |
} |
This file contains hidden or 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
#!/usr/local/bin/ruby | |
require 'shellwords' | |
args = ARGV | |
size = args.size | |
tab_open = 'tell i term application "System Events" to keystroke "t" using {command down}' | |
v_pane_open = 'tell i term application "System Events" to keystroke "d" using {command down}' | |
h_pane_open = 'tell i term application "System Events" to keystroke "d" using {command down, shift down}' | |
go_left_one_pane = 'tell i term application "System Events" to key code 123 using {command down, option down}' | |
script_builder = Proc.new do |tell, command| |
This file contains hidden or 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
#!/bin/bash | |
touch ~/.gitignore_global_config | |
echo ".DS_Store" >> ~/.gitignore_global_config | |
echo "._.DS_Store" >> ~/.gitignore_global_config | |
echo "**/.DS_Store" >> ~/.gitignore_global_config | |
echo "**/._.DS_Store" >> ~/.gitignore_global_config | |
git config --global core.excludesfile ~/.gitignore_global_config |
When setting these options consider the following:
- How long is your average request?
- What is the maximum number of simultaneous visitors the site(s) get?
- How much memory on average does each child process consume?
sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
This file contains hidden or 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
/****** Object: Table [dbo].[Customer] Script Date: 5/20/2018 10:26:06 AM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[Customer]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Name] [nvarchar](50) NULL, | |
[Email] [nvarchar](200) NULL, | |
[Phone] [nvarchar](200) NULL, |
This file contains hidden or 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
USE [master] | |
GO | |
/****** Object: Database [DapperExample] Script Date: 3/08/2019 3:26:01 PM ******/ | |
CREATE DATABASE [DapperExample] | |
GO | |
USE [DapperExample] | |
GO | |
/****** Object: Table [dbo].[Event] Script Date: 3/08/2019 3:26:01 PM ******/ | |
SET ANSI_NULLS ON | |
GO |
NewerOlder