Skip to content

Instantly share code, notes, and snippets.

View n3dst4's full-sized avatar
:octocat:
fgdxgfdxfg

Neil de Carteret n3dst4

:octocat:
fgdxgfdxfg
View GitHub Profile
@n3dst4
n3dst4 / enable_ms_store.reg
Created March 29, 2018 13:21
How re-enable MS Store if your overzealous local IT have tried to disable it
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore]
"RemoveWindowsStore"=dword:00000000
@n3dst4
n3dst4 / switchy.js
Last active July 7, 2016 07:13
let + switch
// What is the console output of this code?
function switchFoo (foo) {
switch (foo) {
case 1:
foo = 5
console.log(foo)
case 2: {
console.log(foo)
break

1️⃣

🐦🍐🌳

2️⃣

🐢🐦 🐢🐦

🐦🍐🌳

@n3dst4
n3dst4 / renaming.markdown
Last active February 21, 2024 13:56
How to rename Visual Studio solutions and projects

How to rename solutions and projects in Visual Studio

  1. Don't.

How to rename solutions and projects that were created in Visual Studio

  1. Close Visual Studio and don't open it again until I tell you. Visual Studio is not competent at renaming things.
  2. Assuming you're using git, clean the working folder to remove anything that's not in version control (this will help the search-and-replace step because it won't have to go through a bunch of generated files)

git clean -fdx

@n3dst4
n3dst4 / dw-sorter.clj
Created August 2, 2015 16:22
DW sorter
(defn episode-number [file]
(def match (re-matches
#"\d{4}-\d{2}-\d{2} - (S\d\d E\d\d) - .*"
(.getName file)))
(if (= match nil)
nil
(match 1)))
(def episodes (partition-by episode-number files))
@n3dst4
n3dst4 / browserify_transforms.markdown
Created September 22, 2014 07:52
Troubleshooting how Browserify transforms get applied (i.e. why isn't my code getting processed by Reactify?)

If you're using Browserify and Reactify to write React components and build them for the browser, you may, depending on your setup, see errors along the lines of "unexpected token <", which means that your code is not getting Reactified properly. You will either see this in Gulp, because some subsequent step in the pipeline can't parse your code, or in the browser.

Here's how browserify decides how to apply transforms:

  1. Anything specified when you actually call browserify (i.e. in a gulpfile or on the command line) will be run first. Calls here can specify {global: true}, which will make them be applied to dependencies as well as code in the current module.
  2. If there is a browserify.transform key in package.json, it can list transforms which should be applied, in the order that they should be applied.

You need to specify reactify before anything else which is going to want to parse the code, because obvs. it isn't valid es5 until it's been reactified (so e.g. having `["browserify-shim", "reactify"

@n3dst4
n3dst4 / ConEmu Git Bash.md
Last active July 19, 2022 17:11
My ConEmu / Cmder git bash task config
  1. Open Conemu

  2. Open Settings -> Tasks or go to new tab button -> Setup tasks.

  3. Click + to add a new task

  4. Enter the name as Git Bash or whatever you like

  5. Task parameters:

     /icon "C:\Program Files (x86)\Git\etc\git.ico" /dir "C:\_git"
    
  6. Command:

@n3dst4
n3dst4 / gulpfile.js
Created August 13, 2014 12:09
A gulp task that runs "npm install" with options passed thru from command line
gulp.task("install", function(cb) {
var npm = require("npm");
npmConfig = {};
// sample command line opts, you may have others
if (gUtil.env["npm-cache-path"]) npmConfig.cache = gUtil.env["npm-cache-path"];
if (gUtil.env["npm-log-level"]) npmConfig.loglevel = gUtil.env["npm-log-level"];
npm.load(npmConfig, function (er) {
if (er) return cb(er);
npm.commands.install([], function (er, data) { cb(er); });
@n3dst4
n3dst4 / requireTime.js
Created August 13, 2014 08:15
Time how long all your require()s take
/*
* requireTime.js
*
* require()s every thing in your node_modules and tells you how long each one
* took.
*
* USAGE:
* $ cd your_project_folder
* $ node loadTest.js
*
@n3dst4
n3dst4 / bash_here.bat
Last active August 29, 2015 14:04
Start bash in Console2 with $HOME set to a folder of your choice
@echo off
rem If Windows's idea of $HOME is wrong for you, you can use
rem Console2 and instead of using bash directly, use this batch
rem file instead. It will set $HOME to wherever it is located.
set PATH=%PATH%;%~dp0
set HOME=%~dp0
rem adjust path to suit