Skip to content

Instantly share code, notes, and snippets.

@charlieanstey
charlieanstey / 0_reuse_code.js
Created March 5, 2014 15:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@charlieanstey
charlieanstey / field-helpers.cshtml
Created July 22, 2014 09:15 — forked from willprice76/field-helpers.cshtml
Tridion :: Razor helpers for Experience Manager in 2013 SP1
@using Tridion.ContentManager.Templating.Expression
@using Tridion.ContentManager.ContentManagement
@using Tridion.Extensions.Mediators.Razor.Models
@* --------------- IDENTIFYING FIELDS ---------------------- *@
@helper FieldStartMarker(string fieldExpression)
{
var fn = new BuiltInFunctions(TridionHelper.Engine, TridionHelper.Package);
@fn.FieldStartMarker(fieldExpression)
@charlieanstey
charlieanstey / ldap-config.properties
Last active March 2, 2021 12:48
TeamCity :: LDAP Configuration
### MANDATORY SETTINGS ###
# The url(s) of LDAP server, with URL escaping e.g. "%20"
java.naming.provider.url=ldap://dc.degree53.local:389/DC=degree53,DC=local
# The credentials to browse and sync LDAP
java.naming.security.principal=teamcity
java.naming.security.credentials=
# Users base DN, relative to "java.naming.provider.url"
@charlieanstey
charlieanstey / mysql_common_commands.sql
Last active May 1, 2018 11:38
#MySQL common commands
# Create database
CREATE DATABASE name;
# Show databases
SHOW DATABASES;
# Use database
USE database;
@charlieanstey
charlieanstey / bash.sh
Created February 13, 2015 18:10
MySQL :: mysqldump commands, transfer
# Shell scripts
# Dump database and unzip
mysqldump db_name -u user_name -p | gzip > db_uname.sql.gz
# Unzip and import database
gunzip < db_name.sql.gz | mysql db_name -u user_name -p
# Transfer database (on source server)
@charlieanstey
charlieanstey / trello-json-export.js
Created February 16, 2015 13:26
Trello :: Export JSON to console using Node.js
'use strict';
var readline = require('readline');
// ------------------
function TrelloJsonExport() {}
TrelloJsonExport.prototype.outputComments = function(json) {
json = JSON.parse(json);
@charlieanstey
charlieanstey / project.csproj
Last active January 7, 2020 15:45
Visual Studio :: Skip files like App_Data during deployment, MSBuild,
<PropertyGroup>
<OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
<ItemGroup>
<MsDeploySkipRules Include="SkipDeleteAppData">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath>
<XPath>
@charlieanstey
charlieanstey / buildAgent.properties
Created March 18, 2015 10:57
TeamCity :: Windows build agent default config
## Required
# Default protocol http, specify otherwise
# May point to proxy
serverUrl=http\://teamcity.example.com
# Defaults to system hostname
name=Windows
# Checked out repositories
@charlieanstey
charlieanstey / httpd.conf
Last active May 1, 2018 11:27
#Apache :: Proxy config, HTTP, HTTPS SSL TLS
# HTTP Proxy
# against specific NIC
<VirtualHost 10.10.10.1:80>
ServerName example.com
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://10.10.10.2:80/
ProxyPassReverse / http://10.10.10.2:80/
ProxyTimeout 60
@charlieanstey
charlieanstey / bash.sh
Created April 15, 2015 09:23
Shell :: Output to file using sudo
# Use tee
# from http://stackoverflow.com/a/550808/4498130
echo 'deb blah # blah' | sudo tee --append /etc/apt/sources.list