Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
elijahmanor / common-react-bugs.md
Last active May 29, 2019 19:51
Common Bugs when Learning React

Common Bugs when Learning React

The following list tries to summarize some of the things that a developer may encounter while learning React. The list focuses on scenarios that result in actual bugs (things that don't work) or things that cause warnings in the console.

  • using class prop instead of className (for/htmlFor, etc...)
  • trying to set the style prop with a string
  • not having a parent element or fragment
  • not binding (at all or incorrectly)
  • using the wrong lifecycle hook
  • misspelling componentWillReceiveProps
@richorama
richorama / create models.sql
Last active November 6, 2018 19:35
Sql script to create C# classes from a database schema
declare @Result varchar(max)
declare @TableName varchar(256)
DECLARE table_cursor CURSOR
FOR Select name from sysobjects where xtype = 'U' -- or 'V'
OPEN table_cursor
FETCH NEXT FROM table_cursor
INTO @TableName
@jkrems
jkrems / es-module-history.md
Last active November 5, 2023 19:35
History of ES modules

Modules - History & Future

History

@thorsman99
thorsman99 / TempTableDrop.sql
Created November 29, 2017 12:44
Drop Temp Table if Exists #sql
IF OBJECT_ID('tempdb..#Results') IS NOT NULL DROP TABLE #Results
@ryantuck
ryantuck / gpg_test.py
Last active April 30, 2024 23:44
working example of using gnupg in python
# install:
# pip3 install python-gnupg
# note - gpg needs to be installed first:
# brew install gpg
# apt install gpg
# you may need to also:
# export GPG_TTY=$(tty)
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@GeorgeTsiokos
GeorgeTsiokos / ServiceLocator.cs
Last active July 21, 2017 19:08
If you want a set-once static instance property, and for calling threads to block until it's set...
public static class ServiceLocator
{
static readonly TaskCompletionSource<IContainer> __container = new TaskCompletionSource<IContainer>();
public static IContainer Instance {
get => __container.Task.Result;
set => __container.SetResult(value);
}
@GeorgeTsiokos
GeorgeTsiokos / TestMetadataAdapter.cs
Created June 30, 2017 11:56
Lightstreamer .NET metadata adapter for authentication
internal class TestProvider : LiteralBasedProvider
{
public override void NotifyUser(string user, string password)
{
Console.WriteLine($"NotifyUser {user} {password}");
if (false)
throw new AccessException("Unauthorized user");
}
}
# Win-R, iexplore http://boxstarter.org/package/url?https://gist.githubusercontent.com/yzorg/...
Enable-RemoteDesktop
# Use **Developer** in Win10 settings to enable Explorer: file extensions, show full path, show hidden & system files, etc.
# manual, in powershell admin: `Set-ExecutionPolicy Unrestricted -Force`
# https://scotch.io/bar-talk/trying-the-new-wsl-2-its-fast-windows-subsystem-for-linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# manual: install Pengwin (formerly WLinux) or Ubuntu
# wsl -l
@developit
developit / unistore.js
Last active September 8, 2020 15:13
Update: the newer & better version of this is published: https://github.com/developit/unistore
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/