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
function deepEq( x, y, propertyList, pred ) { | |
if ( x === y ) return true; | |
// if both x and y are null or undefined and exactly the same | |
if ( ! ( x instanceof Object ) || ! ( y instanceof Object ) ) return false; | |
// if they are not strictly equal, they both need to be Objects | |
if ( x.constructor !== y.constructor ) return false; | |
// they must have the exact same prototype chain, the closest we can do is | |
// test there constructor. |
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
// correct object cloning | |
function clone(obj, fields) { | |
if (null == obj || "object" != typeof obj) return obj; | |
if (obj.constructor == File && obj.size) | |
return obj | |
var copy = obj.constructor(); | |
if (fields){ | |
for (let i of fields) | |
if (obj.hasOwnProperty(i)) |
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
"workbench.colorCustomizations": { | |
"[Eiffel]": { | |
"editorGroupHeader.noTabsBackground": "#eee", | |
}, | |
}, | |
"editor.tokenColorCustomizations": { | |
"[Eiffel]": {"textMateRules": [ | |
{"settings":{"foreground":"#000"},"scope":[ | |
"invalid.illegal.unrecognized-tag.html", |
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
{ | |
"workbench.colorCustomizations": { | |
"[Default Light+]": { | |
"panel.background": "#eee", | |
"terminal.background": "#fff", | |
"editorPane.background": "#eee", | |
"editorGutter.background": "#eee", | |
"editorGroupHeader.noTabsBackground": "#eee", | |
"list.inactiveSelectionBackground": "#cde", | |
"sideBar.border": "#ccc", |
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
from django.db.models import Sum | |
from .models import Item | |
# for django < 1.8 | |
group_sums = Item.objects.filter(deleted=None).values('user').annotate(sum=Sum('price', field='price*quantity')) | |
# group_sums :: [{'user': 123, 'sum': 9999}] | |
# values + annotate => GROUP BY in sql |
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
module Main exposing (main) | |
import Browser | |
import Browser.Events as Events | |
import Browser.Dom as Dom | |
import Html exposing (Html, button, div, text) | |
import Html.Attributes exposing (class, style, id) | |
import Html.Events exposing (onClick) | |
import Html.Events.Extra.Mouse as Mouse | |
import Json.Decode as D |
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
<script> | |
;window.addEventListener('load', () => { | |
/// пример <span data-count-from='0' data-count-to='8000000' data-count-duration='2000'>8.000.000</span> | |
function onceVisible(el, callback) { | |
new IntersectionObserver((entries, observer) => { | |
entries.forEach(entry => { | |
if (entry.isIntersecting) { | |
callback(el, entry, observer) | |
observer.disconnect() | |
} |
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
function onVisible(el, once=true) { | |
return new Promise((done, fail) => { | |
new IntersectionObserver((entries, observer) => { | |
entries.forEach(entry => { | |
if (entry.intersectionRatio > 0) { | |
done(el, observer, entry) | |
if (once) {observer.disconnect()} | |
} | |
}) | |
}).observe(el) |
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
{ | |
"workbench.colorCustomizations": { | |
"[Visual Studio Dark]": { | |
// Emerald 028a0f | |
// Pistachio b2d3c2 | |
// Fern 5dbb63 | |
// Parakeet 03c04a | |
"editor.background": "#5dbb63", | |
"editor.foreground": "#fffc", | |
"editorIndentGuide.background": "#0001", |
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
module Main exposing (main) | |
import Browser | |
import Html exposing (Html, button, div, text, input, label, button) | |
import Html.Attributes exposing (type_, class, value, name, checked) | |
import Html.Events exposing (onClick) | |
type alias Model = | |
{ count : Int, fields: List Field } |
NewerOlder