Skip to content

Instantly share code, notes, and snippets.

View nCore's full-sized avatar
🖖
simplicity in mind

David nCore

🖖
simplicity in mind
View GitHub Profile
@nCore
nCore / ExampleGame.cs
Created June 2, 2024 15:13 — forked from aethercowboy/ExampleGame.cs
Monogame with IHostedService DI
public class ExampleGame : Game, IGame
{
public Game Game => this;
private readonly ISomeDependency _someDependency;
public ExampleGame(ISomeDependency someDependency)
{
_someDependency = someDependency;
}
@nCore
nCore / delete_git_submodule.md
Created March 29, 2023 12:19 — forked from myusuf3/delete_git_submodule.md
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
@nCore
nCore / foo.tsx
Created August 9, 2021 05:21 — forked from OliverJAsh/foo.tsx
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;
@nCore
nCore / svgfixer.js
Created March 4, 2016 12:17 — forked from leonderijke/svgfixer.js
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@nCore
nCore / pagination.html.twig
Created February 8, 2016 20:23 — forked from SimonSimCity/pagination.html.twig
A gist for pagination in Twig, based on the total number of pages, the current page and some URL-settings.
{#
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/
Updated by: Simon Schick <[email protected]>
Parameters:
* currentFilters (array) : associative array that contains the current route-arguments
* currentPage (int) : the current page you are in
* paginationPath (string) : the route name to use for links
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled)
* lastPage (int) : represents the total number of existing pages
@nCore
nCore / setenv.sh
Last active August 29, 2015 14:18 — forked from terrancesnyder/setenv.sh
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@nCore
nCore / setenv.sh
Last active August 29, 2015 14:18 — forked from terrancesnyder/setenv.sh
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@nCore
nCore / gist:9d4b10f3f1c49e33fa7e
Created October 27, 2014 09:23
When therubyracer won't install
I got it fixed by a dumb solution:
brew install v8
bundle install
# after failing go to
cd /Users/alecslupu/.rvm/gems/ruby-1.9.3-p448@my_gemset/gems/libv8-3.3.10.4/lib/libv8/build/v8
ln -s /usr/local/Cellar/v8/3.21.17/lib/libv8_base.x64.a ./libv8.a
bundle update
Aparently the problem is in libv8 (3.3.10.4) gem that is not building on a mavericks system, for that reason the "libv8.a" is never created.
@nCore
nCore / gist:0ac5dda23d79d5c8f792
Created October 20, 2014 12:33
Installing MAMP + XDEBUG + MacGDBp
1. Install MacGDBp.
2. Install MAMP.
3. Open the php.ini at /Applications/MAMP/bin/php/php5.3.6/conf/php.ini and uncommented the only line containing the xdebug.so file.
4. Add this lines at the end of php.ini
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
#!/usr/bin/env bash
# SEE YOU SPACE COWBOY by DANIEL REHN (danielrehn.com)
# Displays a timeless message in your terminal with cosmic color effects
# Usage: add "sh ~/seeyouspacecowboy.sh; sleep 2" to .bash_logout (or similar) in your home directory
# (adjust the sleep variable to display the message for more seconds)
# Cosmic color sequence