Skip to content

Instantly share code, notes, and snippets.

@inDream
inDream / parse-server+4.5.0.patch
Created May 28, 2021 09:45
parse-server Upsert Patch
diff --git a/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js b/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js
index 79bb747..a85e5ad 100644
--- a/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js
+++ b/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoStorageAdapter.js
@@ -488,6 +488,9 @@ class MongoStorageAdapter {
upsertOneObject(className, schema, query, update, transactionalSession) {
schema = convertParseSchemaToMongoSchema(schema);
const mongoUpdate = (0, _MongoTransform.transformUpdate)(className, update, schema);
+ mongoUpdate.$setOnInsert = {};
+ mongoUpdate.$setOnInsert._created_at = mongoUpdate.$set._created_at;
import java.util.*;
public class RockPaperScissors {
public static void main(String[]args) {
int s[] = {2, 0, 1};
String name[] = {"rock", "paper", "scissors"};
System.out.println("Rock-Paper-Scissors\n===================");
Scanner scn = new Scanner(System.in);
System.out.print("Enter 0 for rock, 1 for paper, or 2 for scissors: ");
int A = scn.nextInt();
Random ran = new Random();
@inDream
inDream / table.html
Created September 2, 2017 17:03
js-framework-benchmark
<!DOCTYPE html><html lang="en"><meta charset="utf-8" /><head> <title>Table Report</title> <link rel="stylesheet" href="../css/github-markdown.css"> <style> body { overflow:scroll; } table.results { font-size: 10px; table-layout: fixed; width: 1px; overflow:visible; display: table; } table.results th { width: 60px; } table.results th.benchname { width: 100px; }table.results td { padding: 3px;}table.results th { padding: 3px;}.top1 {background-color: #63BF7C;}.top2 {background-color: #D1D580;}.top3 {background-color: #FFEC84;}.top4 {background-color: #FCAA78;}.top5 {background-color: #F9696C;}td {text-align: center;}.rowCount {font-size: 8px;}.deviation {font-size: 8px;padding-left: 5px;}.deviation:before {content: '± ';}.factor {font-size: 8px;}</style></head><body class="markdown-body"><h1><a href="https://github.com/krausest/js-framework-benchmark" target="_blank">js-framework-benchmark</a></h1><h1>Keyed results</h1><p>Keyed implementations create an association between the domain data and a dom element
by
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body {
font-family: "Segoe UI", Helvetica, Arial, sans-serif;
text-align: center;
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@inDream
inDream / components.home.js
Created August 6, 2015 04:07
Routable components
import Ember from 'ember';
export default Ember.Component.extend({
isGlimmerComponent: true,
name: 'Home'
});
@inDream
inDream / TwentyBot
Last active August 29, 2015 14:21 — forked from alandownie/TwentyBot
function getPieces() {
var arr = [];
it = b.pieces();
while (it.current()){ arr.push(it.current()); it.next() }
return arr;
}
var needCalcPos = true;
var arr = [];
var current = 0;
@inDream
inDream / Ember.HistoryJsLocation.js
Created June 17, 2013 11:57
【Ember.js】使用History.js讓瀏覽器支援history API http://indreamhk.blogspot.com/2013/06/emberjs-historyjs.html
(function() {
var get = Ember.get, set = Ember.set;
var popstateFired = false;
/**
Ember.HistoryJsLocation implements the location API using History.js.
@class HistoryJsLocation
@namespace Ember RC5
@extends Ember.Object
*/
Ember.HistoryJsLocation = Ember.Object.extend({