This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */ | |
//return an array of objects according to key, value, or key and value matching | |
function getObjects(obj, key, val) { | |
var objects = []; | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) continue; | |
if (typeof obj[i] == 'object') { | |
objects = objects.concat(getObjects(obj[i], key, val)); | |
} else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="container" style="height:100%;"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Result | |
{ | |
public bool Success { get; private set; } | |
public string Error { get; private set; } | |
public bool Failure | |
{ | |
get { return !Success; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shoutout to MBoros on stackoverflow | |
public static class ExpressionCombiner { | |
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> exp, Expression<Func<T, bool>> newExp) | |
{ | |
// get the visitor | |
var visitor = new ParameterUpdateVisitor(newExp.Parameters.First(), exp.Parameters.First()); | |
// replace the parameter in the expression just created | |
newExp = visitor.Visit(newExp) as Expression<Func<T, bool>>; | |
// now you can and together the two expressions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Dummy | |
{ | |
class Program | |
{ | |
private static void Header(string title) | |
{ | |
Console.WriteLine(new string('=', 79)); | |
Console.WriteLine(title); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Entity | |
{ | |
public long Id { get; set; } | |
[SuppressMessage("ReSharper", "BaseObjectGetHashCodeCallInGetHashCode")] | |
[SuppressMessage("ReSharper", "NonReadonlyMemberInGetHashCode")] | |
public override int GetHashCode() | |
{ | |
if (IsTransient()) | |
return base.GetHashCode(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { injectStyle } from 'styl-injector'; | |
const rippleStyleObj = { | |
"[data-animation]": { position: "relative", overflow: "hidden" }, | |
".ripple": { | |
width: "2px", | |
height: "2px", | |
position: "absolute", | |
borderRadius: "50%", | |
backgroundColor: "rgba(255, 255, 255, 0.5)", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollUp(start?: Function, end?: Function) { | |
const el = (document.documentElement || document.body); | |
if (start) start(); | |
el.scroll({ | |
top: 0, | |
left: 0, | |
behavior: 'smooth' | |
}); | |
if (end) end(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber Gist uses dumber bundler, the default bundle file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const postcss = require('postcss') | |
module.exports = { | |
theme: { | |
extend: {} | |
}, | |
variants: { | |
float: ['responsive', 'rtl'], | |
margin: ['responsive', 'rtl'], | |
padding: ['responsive', 'rtl'], |