Skip to content

Instantly share code, notes, and snippets.

@axrwkr
axrwkr / pointers.cpp
Last active August 29, 2015 13:59
C++ Reference and Dereference Operators
/*
on os x compile with (install xcode and command line tools)
clang++ pointers.cpp -o pointers
on windows compile with (install visual studio)
cl /EHsc pointers.cpp
on linux compile with (apt-get install g++)
g++ pointers.cpp -o pointers
*/
@axrwkr
axrwkr / structure_pointers.cpp
Last active August 29, 2015 13:59
C/C++ Structure Reference and Structure De-Reference operators
/*
on os x compile with
clang++ structure_pointers.cpp -o structure_pointers
on windows compile with
cl /EHsc structure_pointers.cpp
on linux compile with
g++ structure_pointers.cpp -o structure_pointers
*/
@axrwkr
axrwkr / scope_operator.cpp
Created April 13, 2014 20:21
C++ Scope Operator
/*
on os x compile with
clang++ scope_operator.cpp -o scope_operator
on windows compile with
cl /EHsc scope_operator.cpp
on linux compile with
g++ scope_operator.cpp -o scope
*/
@axrwkr
axrwkr / broscript.js
Last active August 29, 2015 14:08 — forked from CS1000/broscript.js
Paste in SO chat room console bro:
(function() {
"use strict";
var chat = document.getElementById('chat');
function parseNode(node) {
if (node.classList
&& node.classList.contains('message')
&& !node.classList.contains('pending')
&& !node.querySelector('.onebox')
@axrwkr
axrwkr / radiant date tag.rb
Created April 29, 2015 14:53
Radiant CMS date tag
tag 'date' do |tag|
page = tag.locals.page
format = (tag.attr['format'] || '%A, %B %d, %Y')
time_attr = tag.attr['for']
date = if time_attr
case
when time_attr == 'now'
Time.zone.now
when Page.date_column_names.include?(time_attr)
page[time_attr]
@axrwkr
axrwkr / convert
Created July 21, 2015 08:24
Convert m4a to mp3 at 96k
ffmpeg -i "in.m4a" -ab 96k "out.mp3"
@axrwkr
axrwkr / List COLLACTION.sql
Created September 18, 2015 13:56
List collations for all columns in all tables
-- Find Collation of SQL Server Database
SELECT DATABASEPROPERTYEX('<database-name>', 'Collation')
-- list column collations
SELECT o.name, C.name, collation_name
FROM sys.columns C
INNER JOIN sys.objects O
ON O.object_id = c.object_id
WHERE O.type = 'U'
AND collation_name IS NOT NULL
@axrwkr
axrwkr / MSSQL Version Info.sql
Last active February 8, 2016 12:38
MS SQL Version Info
SELECT
CASE
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '8.00.%' THEN 'Microsoft SQL Server 2000'
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '9.00.%' THEN 'Microsoft SQL Server 2005'
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '10.00.%' THEN 'Microsoft SQL Server 2008'
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '10.50.%' THEN 'Microsoft SQL Server 2008 R2'
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '11.0%' THEN 'Microsoft SQL Server 2012'
WHEN CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(20)) LIKE '12.0%' THEN 'Microsoft SQL Server 2014'
END Product,
SERVERPROPERTY('ProductVersion') [Product Version],