Skip to content

Instantly share code, notes, and snippets.

View truseed's full-sized avatar

Needle Eye truseed

View GitHub Profile
@truseed
truseed / git.css
Created April 26, 2016 11:20 — forked from neilgee/git.css
Git Command Line Reference - Notes and reminders on set up and commands
/*
* Set up your Git configuration
*/
git config --global user.email "you@yourdomain.com"
git config --global user.name "Your Name"
git config --global core.editor "nano"
@truseed
truseed / TypeExtensions.IsSimpleType.cs
Created August 2, 2016 08:28 — forked from jonathanconway/TypeExtensions.IsSimpleType.cs
Determine whether a type is simple.
public static class TypeExtensions
{
/// <summary>
/// Determine whether a type is simple (String, Decimal, DateTime, etc)
/// or complex (i.e. custom class with public properties and methods).
/// </summary>
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/>
public static bool IsSimpleType(
this Type type)
{
@truseed
truseed / introrx.md
Created September 8, 2016 19:35 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@truseed
truseed / linq.js
Created September 21, 2016 10:30
Linq implementation in ES6
let linq = function*(array){
for (let item of array){
yield item;
}
};
let where = function*(predicate){
for(let item of this){
if (predicate(item)) {
yield item;
//We will create a function to be extended to all String Objects
//This Injects the function into the String Object so any String Object will be able to call count
String.prototype.count = function countV() {
//store Object
var StringObj = this;
//Because countV is a function that will extend the String Object this will refer to the String itself if
//Our Json Object to Hold Data this is more efficient as you can return multiple results in one Object
var letter = { vowel: 0, consonant: 0 };
//Our loop
for (var i = 0; i < StringObj.length; i++) //Remember StringObj holds the String Object
@truseed
truseed / selectMany.js
Created April 4, 2017 15:28 — forked from aaronpowell/selectMany.js
LINQ SelectMany in JavaScript
Array.prototype.selectMany = function (fn) {
return this.map(fn).reduce(function (x, y) { return x.concat(y); }, []);
};
// usage
console.log([[1,2,3], [4,5,6]].selectMany(function (x) { return x; })); //[1,2,3,4,5,6]
console.log([{ a: [1,2,3] }, { a: [4,5,6] }].selectMany(function (x) { return x.a; }));
@truseed
truseed / git-pushing-multiple.rst
Created January 24, 2018 14:39 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@truseed
truseed / app.js
Created February 1, 2018 14:57 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@truseed
truseed / readme.md
Created February 15, 2018 17:10 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@truseed
truseed / css-units-best-practices.md
Created August 9, 2018 12:21 — forked from basham/css-units-best-practices.md
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units