Skip to content

Instantly share code, notes, and snippets.

View Sangrene's full-sized avatar

Hugo Laplace-Builhe Sangrene

View GitHub Profile
@simlrh
simlrh / getKeys.ts
Last active March 2, 2021 17:45
Miscellaneous TypeScript helpers
// Wrapper for Object.keys which sets the correct type
export function getKeys<T>(obj: T): Array<keyof T> {
return Object.keys(obj) as Array<keyof T>;
}
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active June 19, 2024 14:20
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@FrostyZoob
FrostyZoob / iso9601DateConv.js
Created October 15, 2012 18:09
Automatic ISO 8601 conversion in Javascript
$.ajaxSetup({
converters: { "text json": function (jsonString) {
var res = JSON.parseWithDate(jsonString);
if (res && res.hasOwnProperty("d"))
res = res.d;
return res;
} }
});