Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
anaisbetts / GravatarLoader.cs
Created August 14, 2013 16:20
Gravatar loading and caching using Akavache and Splat
using System;
using Akavache;
using Splat;
using System.Security.Cryptography;
using System.Text;
using System.Globalization;
using ReactiveUI;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
@sanderhahn
sanderhahn / gulpfile.js
Last active September 11, 2019 14:45
Minify and templateCache your Angular Templates using Gulp
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var templates = require('gulp-angular-templatecache');
var minifyHTML = require('gulp-minify-html');
// Minify and templateCache your Angular Templates
// Add a 'templates' module dependency to your app:
// var app = angular.module('appname', [ ... , 'templates']);
@lontivero
lontivero / gist:593fc51f1208555112e0
Last active June 24, 2023 20:05
Generates Markdown from VS XML documentation file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace GithubWikiDoc
{
@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
@herskinduk
herskinduk / ArticleViewRendering.cshtml
Last active April 29, 2016 08:34
Sitecore MVC inside-out layout
@using Sitecore.Mvc.Presentation
@using Sitecore.Mvc
@model RenderingModel
@{
Layout = null;
Sitecore.Context.Items["twitter:title"] = Model.Item["title"]
Sitecore.Context.Items["twitter:description"] = Model.Item["description"]
}
<h1>@Html.Sitecore().Field("title")</h1>
@Html.Sitecore().Field("text")
@davidfowl
davidfowl / dotnetlayout.md
Last active May 5, 2024 11:47
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@yocontra
yocontra / LazyLoad.js
Created December 2, 2014 01:23
lazy loading react components, useful for video/audio/etc
var React = require('react');
var events = require('add-event-listener');
var isVisible = require('../isVisible');
var LazyLoad = React.createClass({
displayName: 'LazyLoad',
propTypes: {
distance: React.PropTypes.number,
component: React.PropTypes.node.isRequired,
children: React.PropTypes.node.isRequired
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@anaisbetts
anaisbetts / request-rx.js
Created February 18, 2015 06:36
Rx'ification of request
'use 6to5';
const rx = require('rx');
const request = require('request');
let wrapMethodInRx = (method) => {
return function(...args) {
return rx.Observable.create((subj) => {
// Push the callback as the last parameter
args.push((err, resp, body) => {
@nicolashery
nicolashery / rxjs-react.js
Last active August 1, 2022 03:36
Fetching data asynchronously with RxJS and React
import React from 'react';
import _ from 'lodash';
import Rx from 'rx';
import superagent from 'superagent';
let api = {
host: 'http//localhost:3001',
getData(query, cb) {
superagent