Skip to content

Instantly share code, notes, and snippets.

@gpuido
gpuido / quantize.js
Created April 13, 2017 14:32 — forked from nrabinowitz/quantize.js
Javascript module for color quantization, based on Leptonica
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@gpuido
gpuido / bulmatoscss_gulpfile.js
Created July 30, 2017 11:35 — forked from kritollm/bulmatoscss_gulpfile.js
Converts Bulma CSS framework from SASS to SCSS
// Bulma to scss gulp script
// In your terminal
// 1. npm install -D sass-convert gulp bulma gulp-sass gulp-replace
// 2. gem install sass
var gulp = require("gulp"),
replace = require('gulp-replace'),
converter = require('sass-convert'),
sass = require('gulp-sass');
###
### Save this file as "install-software.ps1"
###
# check for elevated powershell
write-host -nonewline -fore cyan "Info: Verifying user is elevated:"
If (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
write-host -fore Red "NO"
return write-error "You must run this script elevated."
}
@gpuido
gpuido / gulp-tab.ps1
Created August 25, 2017 10:35 — forked from fearthecowboy/gulp-tab.ps1
Better gulp tab expansion script
# Copyright (c) 2014 Jason Jarrett
#
# Tab completion for the `gulp`
#
# Usage:
#
# To enable powershell <tab> completion for gulp you need to be running
# at least PowerShell v3 or greater and add the below to your $PROFILE
#
# Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine)
@gpuido
gpuido / test.cmd
Created August 25, 2017 10:38 — forked from fearthecowboy/test.cmd
Make a powershell script with a .cmd (or .bat) extension
@powershell -noninteractive "& ([Scriptblock]::Create( ((gc -raw '%~df0') -replace '^@powershell.*' ) )) %*" & goto :eof
###
### Example : Just use that first line in a .cmd file and it will execute this file with powershell!
###
param( $name, $lastname )
write-host -fore green "Well, hello $name $lastname"
<# Notes:
this works just fine from cmd (or powershell) - even with named parameters:
@gpuido
gpuido / Install-Stack.ps1
Created August 25, 2017 10:43 — forked from fearthecowboy/Install-Stack.ps1
Install software stack.
###
### Save this file as "install-software.ps1"
###
# check for elevated powershell
write-host -nonewline -fore cyan "Info: Verifying user is elevated:"
If (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
write-host -fore Red "NO"
return write-error "You must run this script elevated."
}
@gpuido
gpuido / associate-powershell.ps1
Created August 25, 2017 11:04 — forked from fearthecowboy/associate-powershell.ps1
Make PowerShell scripts runnable from anywhere ( ie, CMD.EXE, Explorer, Run Dialog, etc)
#==============================================================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@gpuido
gpuido / example.msbuild.xml
Created August 25, 2017 11:05 — forked from fearthecowboy/example.msbuild.xml
Super Simple PowerShell task for MSBuild.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- @FearTheCowboy's Simple PowerShell Task for MSBuild -->
<UsingTask TaskName="PowerShell" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup><ScriptBlock ParameterType="System.String" Required="true" /></ParameterGroup>
<Task><Reference Include="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"/><Code Type="Class" Language="cs"><![CDATA[
public class PowerShell : Microsoft.Build.Tasks.Exec {
public string ScriptBlock {set { EchoOff=true; Command = string.Format( "@powershell \"Invoke-Command -ScriptBlock {{ $errorActionPreference='Stop'; {0} ; exit $LASTEXITCODE }} \"", value.Replace("\"","\"\"").Replace("\r\n",";").Replace("\n",";").Replace("\r",";")); } }
}]]></Code></Task>
</UsingTask>
@gpuido
gpuido / PowerShellWebServer.ps1
Created August 25, 2017 11:06 — forked from fearthecowboy/PowerShellWebServer.ps1
PowerShell Webserver that restarts when you edit the script.
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
$ErrorActionPreference = "Stop"
#Need to install Nuget packages before execute
Add-Type -Path (Join-Path (Split-Path $profile -Parent) "packages\Windows7APICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll" -Resolve)
Add-Type -Path (Join-Path (Split-Path $profile -Parent) "\packages\Windows7APICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll" -Resolve)
<#
#TODO: Define Interop code to register shortcut with appid
$referencedAssemblies = @(
[MS.WindowsAPICodePack.Internal.PropVariant].Assembly.FullName,