Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
elijahmanor / Chat.after.js
Created April 27, 2018 16:02
Code from Migrating from Unsafe React Lifecycle Hooks https://www.youtube.com/watch?v=G9S1IghlkCI
import React, { Component } from "react";
import Button from "./Button";
import Message from "./Message";
import { getMessage } from "./utils";
export default class Chat extends Component {
state = {
isStreaming: this.props.isStreaming,
messages: [getMessage()]
};
@davidkwast
davidkwast / Dockerfile
Created February 9, 2018 11:24
FTP Server Container
FROM debian:wheezy
MAINTAINER David Kwast <david@kwast.me>
RUN apt-get update && apt-get -y install proftpd && apt-get clean
RUN useradd -g root -d /var/www/html ftpuser && (echo "password";echo "password") | passwd ftpuser
RUN (echo "password";echo "password") | passwd root
@mcguffin
mcguffin / git-release
Last active December 26, 2022 11:09
Shell script to create GitHub release
#!/bin/bash
MESSAGE="0"
VERSION="0"
DRAFT="false"
PRE="false"
BRANCH="master"
GITHUB_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
# get repon name and owner
@runewake2
runewake2 / PhilosophersWithWaiter.cs
Created December 23, 2016 03:50
Solution for the dining philosophers in C# - Solution uses a waiter to oversee acquiring of chopsticks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DiningPhilosophers
{
class Program
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@carlos-jenkins
carlos-jenkins / multihooks.py
Last active August 10, 2023 22:12
Delegating script for multiple git hooks
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 Carlos Jenkins <carlos@jenkins.co.cr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@BDF
BDF / mavenNotes.md
Last active March 8, 2021 12:21
Using the maven shade plugin on a Spring Boot application
  • Maven shade with Spring Boot

The goal was to create an uber-jar out of the Spring boot application. Following the directions given at Apache went very smoothly yet when I tried to execute the jar a large number of spring beans were missing and not getting loaded during runtime. For example, one of the beans not getting loaded was 'AutoConfigurationPackages'

jar -tvf name.jar | grep AutoConfigurationPackages showed that the class file was present in tha jar.

@alexedwards
alexedwards / main.go
Last active May 25, 2024 19:35
Example of chaining middlware in Go
package main
import (
"io"
"log"
"mime"
"net/http"
"os"
"github.com/goji/httpauth"
@vicramon
vicramon / projections.json
Created July 7, 2014 13:41
Javascript Vim Projections for Ember JS
{
"app/assets/javascripts/router.js": {
"command": "jini"
},
"app/controllers/api/v1/*_controller.rb": {
"command": "apicontroller",
"alternate": "spec/controllers/api/v1/%s_controller_spec.rb",
"template": "class Api::V1::%SController < ApplicationController\n respond_to :json\nend"
},
"app/assets/javascripts/models/*.js": {
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active June 11, 2024 14:17
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository