Skip to content

Instantly share code, notes, and snippets.

View kveratis's full-sized avatar

Daniel Petersen kveratis

View GitHub Profile
@kveratis
kveratis / ExampleResultSet.php
Created September 23, 2013 19:31
PHP Examples with PDO
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_NAME', 'mydb');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '...');
try {
$dsn = 'mysql:host=' . DB_HOST . ';port=' . DB_PORT .
';dbname=' . DB_NAME;
$pdo = new PDO($dsn, DB_USERNAME, DB_PASSWORD);
$pdo->setAttribute(PDO::ATTR_ERRMODE,
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[stp_MaintainIndexesInDatabase]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[stp_MaintainIndexesInDatabase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Daniel Petersen
@kveratis
kveratis / .gitignore
Last active May 16, 2017 04:17
Best Visual Studio gitignore
#OS junk files
[Tt]humbs.db
*.DS_Store
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
*.[Oo]bj
@kveratis
kveratis / WeeklyDateRanges.cs
Created July 1, 2014 15:19
Calculating first and last day of week in C#
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WeeklyDateRanges
{
@kveratis
kveratis / .gitmessage.txt
Last active May 15, 2018 16:02
My Git Configuration
Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.
Related work items: #<TFS_ITEM#>
@kveratis
kveratis / counter.js
Created April 24, 2018 04:04
Example Jest Tests
import { createStore } from 'redux';
const INCREASE_COUNT = 'INCREASE_COUNT';
// Action Creator using ES5 Arrow Syntax
export const increaseCount = (amount = 1) => ({
type: INCREASE_COUNT,
payload: amount,
});