Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
@martinusso
martinusso / the-programmers-idea.md
Last active June 16, 2023 17:02
The Programmers Idea

Numbers

Text

  • Reverse a String – Enter a string and the program will reverse it and print it out.
  • Pig Latin – Pig Latin is a game of alterations played on the English language game. To create the Pig Latin form of an English word the initial consonant sound is transposed to the end of the word and an ay is affixed (Ex.: "banana" would yield anana-bay). Read Wikipedia for more information on rules.
  • Count Vowels – Enter a string and the program counts the number of vowels in the text. For added complexity have it report a sum of each vowel found.
  • Check if Palindrome – Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like “racecar”
  • Count Words in a String – Counts the number of individual words in a string. For added complexity read these strings in from a text file and generate a summary.
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };

Аддмитоц, вер 3.0

Так сложилось, что времени на блог в чистом виде у меня сейчас нет. А ссылки, между тем, все приходят и приходят. А я их, разумеется, все букмаркаю и букмаркаю. Я много думал, что с этими ссылками делать. Вот одна из моих гипотез.

Сервис по обсуждению ссылок.

Дада, те кто был на reddit знают - это примерно именно оно, с некоторыми уточнениями. У меня есть интересные ссылки, в среднем на английском языке. Особой пользы в них нет, однако можно было бы предложить живым людям обсуждать эти ссылки, высказывать свои суждения и вообще. Я это вижу так:

  • Поток новостей. Тут показываются последние 10 новостей, которые я вбросил. Есть возможность оставить каменты к каждоый ссылке или проголосовать за понравившиеся чужие каменты. По умолчанию каменты скрыты за кликом, показывается только лучший по голосам камент (если он есть). Наверняка можно задействовать любой из существующих сервисов каментариев, если у него есть нормальный API.
  • Архив новостей. Тут хранятся старые ссылки и каменты к ни
@jbogard
jbogard / rebase.ps1
Created January 28, 2014 17:34
Auto rebase all the things
git config --global push.default tracking
git config --global branch.autosetuprebase always
git config --local branch.master.rebase true
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@thecodejunkie
thecodejunkie / gist:4564425
Created January 18, 2013 13:01
modal binding for knockoutjs that utilizes fancybox internally
ko.bindingHandlers.modal = {
update: function (element, valueAccessor) {
$(element).click(function () {
$.fancybox({ content: $('<div/>').addClass('list-widget').html($('.content', $(element).parent()).html()) });
});
}
};
@hydr
hydr / gist:4338698
Created December 19, 2012 17:47
ToGoogleMapsPolygon
public static List<List<Coordinate>> ToGoogleMapsPolygon(this DbGeography dbGeo)
{
// contains all geo data for one postal code / admin area code
// conversion to SqlGeography because DbGeography does not offer properties to determine rings within geometries. we need those ring information to display areas with holes
var sqlGeo = (SqlGeography) dbGeo.ProviderValue;
var numberOfGeometries = sqlGeo.STNumGeometries();
var result = new List<List<Coordinate>>((int) numberOfGeometries);
@npryce
npryce / property-based-testing-tools.md
Last active July 29, 2024 08:38
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python: