This file contains 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
// Updated Generic BaseController | |
[ApiController] | |
[Route("api/[controller]")] | |
public class BaseController<TEntity> : ControllerBase where TEntity : BaseEntity | |
{ | |
private readonly YourDbContext _context; | |
public BaseController(YourDbContext context) | |
{ | |
_context = context; |
This file contains 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
// BaseEntity for common properties | |
public abstract class BaseEntity | |
{ | |
public int Id { get; set; } | |
// Add other common properties if needed | |
} | |
// Example entities | |
public class Invoice : BaseEntity | |
{ |
This file contains 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
type CommonKeys<T extends object> = keyof T; | |
type AllKeys<T> = T extends any ? keyof T : never; | |
type Subtract<A, C> = A extends C ? never : A; | |
type NonCommonKeys<T extends object> = Subtract<AllKeys<T>, CommonKeys<T>>; | |
type PickType<T, K extends AllKeys<T>> = T extends { [k in K]?: any } | |
? T[K] |
This file contains 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
/** | |
* | |
* Strings | |
* | |
* .split() | |
* .toLowercase() | |
* .substring() | |
* .startsWidth() | |
*/ |
This file contains 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 describe = (description, callback) => { | |
console.log(description); | |
callback(); | |
}; | |
const it = (message, callback) => describe(` ${message}`, callback); | |
const matchers = expression => ({ | |
toBe: assertion => { | |
if (expression === assertion) { |
This file contains 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 React, { Component } from 'react'; | |
// Webkit or not, here I come, you can't hide 🎶 | |
const transformProperty = (() => { | |
const style = document.documentElement.style; | |
if (typeof style.transform == 'string') { | |
return 'transform'; | |
} | |
return 'WebkitTransform'; | |
})(); |
This file contains 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
(ns todomvc.core | |
(:require [reagent.core :as r])) | |
(defonce todos (r/atom (sorted-map))) | |
(defonce counter (r/atom 0)) | |
(defn add-todo [text] | |
(let [id (swap! counter inc)] | |
(swap! todos assoc id {:id id :title text :done false}))) |
This file contains 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>TO-DO List</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> | |
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> |
This file contains 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
$('label').on('click', function() { | |
$(this).siblings('input').attr('checked', function(index, attr) { | |
return attr == 'checked' ? null : 'checked'; | |
}); | |
}); |
This file contains 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
/* | |
* Simple Sass @mixin to remove default | |
* appearance for Twitter Bootstrap elements | |
*/ | |
@mixin remove-appearance { | |
&, &:hover, &:focus { | |
-webkit-appearance: none; | |
text-decoration: none; | |
outline: 0; |