Skip to content

Instantly share code, notes, and snippets.

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyNamespace
{
import React, { Component } from 'react';
import CheckoutContainer from './containers/CheckoutContainer';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
import * as reducers from './reducers';
import { pouchMiddleware, getState } from './redux-pouchdb';
getState().then(initialState =>{
const createStoreWithMiddleware = applyMiddleware(thunk, pouchMiddleware)(createStore);
@vicentedealencar
vicentedealencar / fiddle.js
Last active December 16, 2015 07:49
Faça um página que calcula a área de determinadas figuras geométricas, exibindo-a. O programa deverá apresentar um menu com as opções abaixo e deverá permitir que o usuário escolha qualquer uma das opções, quantas vezes desejar até que escolha a opção de fim (5). 1 - quadrado (lado*lado) 2 - retângulo (comprimento * largura) 3 - círculo (3,14 * …
var formulas = {
q: function () {
return Math.pow(~~prompt('lado'), 2);
},
r: function () {
return ~~prompt('comprimento') * ~~prompt('largura');
},
c: function () {
return Math.PI * Math.pow(~~prompt('raio'), 2);
},
using AutoMapper;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Miyagi.Common.Helpers
{
public static class AutoMapperExtensions
{
public static List<TResult> MapTo<TResult>(this IEnumerable self)
using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;
using System.Text;
using Raven.Client.UniqueConstraints;
namespace Miyagi.Core.Models
{
[ExcludeFromCodeCoverage]
public abstract class BaseUser
@vicentedealencar
vicentedealencar / HttpExtensions.cs
Created January 23, 2016 06:55
var payload = await client.SendAsync(request).ReadAs<PayloadModel>();
using log4net;
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
namespace CyberBar.BaseAPI.Util
{
public static class HttpExtensions
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace CyberBar.BaseAPI.Util
{
public static class JsonExtensions
{
private static JsonSerializerSettings _settings = new JsonSerializerSettings()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
@vicentedealencar
vicentedealencar / winjs bolierplate
Created April 14, 2016 05:47
inspired on react philosophy
// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
@vicentedealencar
vicentedealencar / HelloMessage.js
Last active June 23, 2016 04:47 — forked from steida/HelloMessage.js
React stateless components with lifecycle proposal
const HelloMessage = props => <div>Hello {props.name}</div>
HelloMessage.intialState = { isMounted: false }
const focusAfterAfterOneSec = el => {
setTimeout(() => {
if (!isMounted) return;
el.focus();
}, 1000);
}
@vicentedealencar
vicentedealencar / InspectableContext.cs
Created January 23, 2016 07:04
fix owin context to read/write request/response
using Microsoft.Owin;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace CyberBar.BaseAPI.Infrastructure
{
public class InspectableContext : IDisposable
{