Skip to content

Instantly share code, notes, and snippets.

@chris-muller
chris-muller / TrimStringProperties.cs
Created February 21, 2016 03:37
Object Extension to trim all string properties.
//http://stackoverflow.com/a/15328864
public static class StringExtensions
{
public static TSelf TrimStringProperties<TSelf>(this TSelf input)
{
var stringProperties = input.GetType().GetProperties()
.Where(p => p.PropertyType == typeof(string));
foreach (var stringProperty in stringProperties)
{
@chris-muller
chris-muller / gulpfile.js
Created February 11, 2016 23:28
Default Sass Gulpfile Template
//Modules
var gulp = require('gulp');
var sass = require('gulp-sass');
//File Paths
var scssFilePath = "./Path/To/scss/**/*.scss";
var cssOutputPath = "./Path/To/css";
// Sass Build Task
gulp.task('css', function(){
using System;
using System.Collections.Generic;
public class IcoSphereCreator
{
private struct TriangleIndices
{
public int v1;
public int v2;
public int v3;
@chris-muller
chris-muller / keybindings.json
Created October 28, 2015 04:44
Visual Studio Code Preferences
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+shift+s", "command": "workbench.action.files.saveAll" }
]
@chris-muller
chris-muller / sass-is-int-function.scss
Last active October 19, 2015 11:47
A Sass function that lets you detect if a value is a unitless integer.
@function isInt($value) {
@if round($value) == $value and unitless($value) {
@return true;
}
@return false;
}
@chris-muller
chris-muller / newline-to-paragraph.php
Last active February 21, 2016 03:56
Convert text between newlines into html <p> tags.
<?php
public function nl2p($string) {
$paragraphs = '';
//split copy into pragraphs
foreach (explode("\n", $string) as $line) {
//trim line and if it isn't empty, add to output
if ($line = trim($line)) {