+ vscode night owl theme

This commit is contained in:
committer
2024-05-15 07:15:59 -05:00
parent e2c14487aa
commit d18120752c
51 changed files with 19760 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"python.linting.enabled": false
}

View File

@@ -0,0 +1,22 @@
import React from 'react';
import ReactDOM from 'react-dom';
import * as TestUtils from 'react-dom/test-utils';
import CheckboxWithLabel from '../CheckboxWithLabel';
it('CheckboxWithLabel changes the text after click', () => {
// Render a checkbox with label in the document
const checkbox = TestUtils.renderIntoDocument(
<CheckboxWithLabel labelOn="On" labelOff="Off" />
)
const checkboxNode = ReactDOM.findDOMNode(checkbox)
// Verify that it's Off by default
expect(checkboxNode.textContent).toEqual('Off')
// Simulate a click and verify that it is now On
TestUtils.Simulate.change(
TestUtils.findRenderedDOMComponentWithTag(checkbox, 'input')
)
expect(checkboxNode.textContent).toEqual('On')
})

View File

@@ -0,0 +1,26 @@
(ns hello.world.clojure)
(defn sum [& numbers]
(if (empty? numbers)
0
(reduce + 0 numbers)))
(defn print-name [{:keys [first last age]}]
(println (str "Your name is " first " " last " and you are " age " years old.")))
(defn set-age [person new-age]
(assoc person :age new-age))
(defn hello-world []
(let [john {:first "John" :last "Smith" :age 65}
jack {:first "Jack" :last "Road" :age 76}
george {:first "George" :last "Way" :age 23}
george-junior (assoc george :age 6)
all-persons [john jack george george-junior]]
(doseq [person all-persons]
(print-name person))
(println (str "Total age is: " (apply sum (map :age all-persons))))))
(hello-world)

View File

@@ -0,0 +1,21 @@
(ns hello.world.clojurescript
(:require [reagent.core :as r])
(def counter (r/atom 0))
(def text-component-style {:background-color :grey
:border "1px solid black"
:padding "5px"})
(defn counter-clicked []
(.log js/console "You clicked the counter component.")
(swap! counter inc))
(defn text-counter [text]
[:div {:on-click counter-clicked
:style text-component-style})
(str text @counter])
(defn main-component []
[:div
[:p {:style {:color :red}} "Hello world! Click the element below:"]
[text-counter "Clicked: "]])

View File

@@ -0,0 +1,616 @@
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_API_H_
#define V8_API_H_
#include "include/v8-testing.h"
#include "src/contexts.h"
#include "src/debug/debug-interface.h"
#include "src/detachable-vector.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
#include "src/objects.h"
#include "src/objects/bigint.h"
#include "src/objects/js-collection.h"
#include "src/objects/js-generator.h"
#include "src/objects/js-promise.h"
#include "src/objects/js-proxy.h"
#include "src/objects/module.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/templates.h"
namespace v8 {
// Constants used in the implementation of the API. The most natural thing
// would usually be to place these with the classes that use them, but
// we want to keep them out of v8.h because it is an externally
// visible file.
class Consts {
public:
enum TemplateType {
FUNCTION_TEMPLATE = 0,
OBJECT_TEMPLATE = 1
};
};
template <typename T>
inline T ToCData(v8::internal::Object* obj);
template <>
inline v8::internal::Address ToCData(v8::internal::Object* obj);
template <typename T>
inline v8::internal::Handle<v8::internal::Object> FromCData(
v8::internal::Isolate* isolate, T obj);
template <>
inline v8::internal::Handle<v8::internal::Object> FromCData(
v8::internal::Isolate* isolate, v8::internal::Address obj);
class ApiFunction {
public:
explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { }
v8::internal::Address address() { return addr_; }
private:
v8::internal::Address addr_;
};
class RegisteredExtension {
public:
explicit RegisteredExtension(Extension* extension);
static void Register(RegisteredExtension* that);
static void UnregisterAll();
Extension* extension() { return extension_; }
RegisteredExtension* next() { return next_; }
static RegisteredExtension* first_extension() { return first_extension_; }
private:
Extension* extension_;
RegisteredExtension* next_;
static RegisteredExtension* first_extension_;
};
#define OPEN_HANDLE_LIST(V) \
V(Template, TemplateInfo) \
V(FunctionTemplate, FunctionTemplateInfo) \
V(ObjectTemplate, ObjectTemplateInfo) \
V(Signature, FunctionTemplateInfo) \
V(AccessorSignature, FunctionTemplateInfo) \
V(Data, Object) \
V(RegExp, JSRegExp) \
V(Object, JSReceiver) \
V(Array, JSArray) \
V(Map, JSMap) \
V(Set, JSSet) \
V(ArrayBuffer, JSArrayBuffer) \
V(ArrayBufferView, JSArrayBufferView) \
V(TypedArray, JSTypedArray) \
V(Uint8Array, JSTypedArray) \
V(Uint8ClampedArray, JSTypedArray) \
V(Int8Array, JSTypedArray) \
V(Uint16Array, JSTypedArray) \
V(Int16Array, JSTypedArray) \
V(Uint32Array, JSTypedArray) \
V(Int32Array, JSTypedArray) \
V(Float32Array, JSTypedArray) \
V(Float64Array, JSTypedArray) \
V(DataView, JSDataView) \
V(SharedArrayBuffer, JSArrayBuffer) \
V(Name, Name) \
V(String, String) \
V(Symbol, Symbol) \
V(Script, JSFunction) \
V(UnboundModuleScript, SharedFunctionInfo) \
V(UnboundScript, SharedFunctionInfo) \
V(Module, Module) \
V(Function, JSReceiver) \
V(Message, JSMessageObject) \
V(Context, Context) \
V(External, Object) \
V(StackTrace, FixedArray) \
V(StackFrame, StackFrameInfo) \
V(Proxy, JSProxy) \
V(debug::GeneratorObject, JSGeneratorObject) \
V(debug::Script, Script) \
V(debug::WeakMap, JSWeakMap) \
V(Promise, JSPromise) \
V(Primitive, Object) \
V(PrimitiveArray, FixedArray) \
V(BigInt, BigInt) \
V(ScriptOrModule, Script)
class Utils {
public:
static inline bool ApiCheck(bool condition,
const char* location,
const char* message) {
if (!condition) Utils::ReportApiFailure(location, message);
return condition;
}
static void ReportOOMFailure(v8::internal::Isolate* isolate,
const char* location, bool is_heap_oom);
static inline Local<Context> ToLocal(
v8::internal::Handle<v8::internal::Context> obj);
static inline Local<Value> ToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<Module> ToLocal(
v8::internal::Handle<v8::internal::Module> obj);
static inline Local<Name> ToLocal(
v8::internal::Handle<v8::internal::Name> obj);
static inline Local<String> ToLocal(
v8::internal::Handle<v8::internal::String> obj);
static inline Local<Symbol> ToLocal(
v8::internal::Handle<v8::internal::Symbol> obj);
static inline Local<RegExp> ToLocal(
v8::internal::Handle<v8::internal::JSRegExp> obj);
static inline Local<Object> ToLocal(
v8::internal::Handle<v8::internal::JSReceiver> obj);
static inline Local<Object> ToLocal(
v8::internal::Handle<v8::internal::JSObject> obj);
static inline Local<Function> ToLocal(
v8::internal::Handle<v8::internal::JSFunction> obj);
static inline Local<Array> ToLocal(
v8::internal::Handle<v8::internal::JSArray> obj);
static inline Local<Map> ToLocal(
v8::internal::Handle<v8::internal::JSMap> obj);
static inline Local<Set> ToLocal(
v8::internal::Handle<v8::internal::JSSet> obj);
static inline Local<Proxy> ToLocal(
v8::internal::Handle<v8::internal::JSProxy> obj);
static inline Local<ArrayBuffer> ToLocal(
v8::internal::Handle<v8::internal::JSArrayBuffer> obj);
static inline Local<ArrayBufferView> ToLocal(
v8::internal::Handle<v8::internal::JSArrayBufferView> obj);
static inline Local<DataView> ToLocal(
v8::internal::Handle<v8::internal::JSDataView> obj);
static inline Local<TypedArray> ToLocal(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Uint8Array> ToLocalUint8Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Uint8ClampedArray> ToLocalUint8ClampedArray(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Int8Array> ToLocalInt8Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Uint16Array> ToLocalUint16Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Int16Array> ToLocalInt16Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Uint32Array> ToLocalUint32Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Int32Array> ToLocalInt32Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Float32Array> ToLocalFloat32Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<Float64Array> ToLocalFloat64Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<BigInt64Array> ToLocalBigInt64Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<BigUint64Array> ToLocalBigUint64Array(
v8::internal::Handle<v8::internal::JSTypedArray> obj);
static inline Local<SharedArrayBuffer> ToLocalShared(
v8::internal::Handle<v8::internal::JSArrayBuffer> obj);
static inline Local<Message> MessageToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<Promise> PromiseToLocal(
v8::internal::Handle<v8::internal::JSObject> obj);
static inline Local<StackTrace> StackTraceToLocal(
v8::internal::Handle<v8::internal::FixedArray> obj);
static inline Local<StackFrame> StackFrameToLocal(
v8::internal::Handle<v8::internal::StackFrameInfo> obj);
static inline Local<Number> NumberToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<Integer> IntegerToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<Uint32> Uint32ToLocal(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<BigInt> ToLocal(
v8::internal::Handle<v8::internal::BigInt> obj);
static inline Local<FunctionTemplate> ToLocal(
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<ObjectTemplate> ToLocal(
v8::internal::Handle<v8::internal::ObjectTemplateInfo> obj);
static inline Local<Signature> SignatureToLocal(
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<AccessorSignature> AccessorSignatureToLocal(
v8::internal::Handle<v8::internal::FunctionTemplateInfo> obj);
static inline Local<External> ExternalToLocal(
v8::internal::Handle<v8::internal::JSObject> obj);
static inline Local<Function> CallableToLocal(
v8::internal::Handle<v8::internal::JSReceiver> obj);
static inline Local<Primitive> ToLocalPrimitive(
v8::internal::Handle<v8::internal::Object> obj);
static inline Local<PrimitiveArray> ToLocal(
v8::internal::Handle<v8::internal::FixedArray> obj);
static inline Local<ScriptOrModule> ScriptOrModuleToLocal(
v8::internal::Handle<v8::internal::Script> obj);
#define DECLARE_OPEN_HANDLE(From, To) \
static inline v8::internal::Handle<v8::internal::To> \
OpenHandle(const From* that, bool allow_empty_handle = false);
OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
#undef DECLARE_OPEN_HANDLE
template <class From, class To>
static inline Local<To> Convert(v8::internal::Handle<From> obj);
template <class T>
static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
const v8::Persistent<T>& persistent) {
return v8::internal::Handle<v8::internal::Object>(
reinterpret_cast<v8::internal::Object**>(persistent.val_));
}
template <class T>
static inline v8::internal::Handle<v8::internal::Object> OpenPersistent(
v8::Persistent<T>* persistent) {
return OpenPersistent(*persistent);
}
template <class From, class To>
static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) {
return OpenHandle(*handle);
}
private:
static void ReportApiFailure(const char* location, const char* message);
};
template <class T>
inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) {
return reinterpret_cast<T*>(obj.location());
}
template <class T>
inline v8::Local<T> ToApiHandle(
v8::internal::Handle<v8::internal::Object> obj) {
return Utils::Convert<v8::internal::Object, T>(obj);
}
template <class T>
inline bool ToLocal(v8::internal::MaybeHandle<v8::internal::Object> maybe,
Local<T>* local) {
v8::internal::Handle<v8::internal::Object> handle;
if (maybe.ToHandle(&handle)) {
*local = Utils::Convert<v8::internal::Object, T>(handle);
return true;
}
return false;
}
namespace internal {
class V8_EXPORT_PRIVATE DeferredHandles {
public:
~DeferredHandles();
private:
DeferredHandles(Object** first_block_limit, Isolate* isolate)
: next_(nullptr),
previous_(nullptr),
first_block_limit_(first_block_limit),
isolate_(isolate) {
isolate->LinkDeferredHandles(this);
}
void Iterate(RootVisitor* v);
std::vector<Object**> blocks_;
DeferredHandles* next_;
DeferredHandles* previous_;
Object** first_block_limit_;
Isolate* isolate_;
friend class HandleScopeImplementer;
friend class Isolate;
};
// This class is here in order to be able to declare it a friend of
// HandleScope. Moving these methods to be members of HandleScope would be
// neat in some ways, but it would expose internal implementation details in
// our public header file, which is undesirable.
//
// An isolate has a single instance of this class to hold the current thread's
// data. In multithreaded V8 programs this data is copied in and out of storage
// so that the currently executing thread always has its own copy of this
// data.
class HandleScopeImplementer {
public:
explicit HandleScopeImplementer(Isolate* isolate)
: isolate_(isolate),
microtask_context_(nullptr),
spare_(nullptr),
call_depth_(0),
microtasks_depth_(0),
microtasks_suppressions_(0),
entered_contexts_count_(0),
entered_context_count_during_microtasks_(0),
#ifdef DEBUG
debug_microtasks_depth_(0),
#endif
microtasks_policy_(v8::MicrotasksPolicy::kAuto),
last_handle_before_deferred_block_(nullptr) {
}
~HandleScopeImplementer() {
DeleteArray(spare_);
}
// Threading support for handle data.
static int ArchiveSpacePerThread();
char* RestoreThread(char* from);
char* ArchiveThread(char* to);
void FreeThreadResources();
// Garbage collection support.
void Iterate(v8::internal::RootVisitor* v);
static char* Iterate(v8::internal::RootVisitor* v, char* data);
inline internal::Object** GetSpareOrNewBlock();
inline void DeleteExtensions(internal::Object** prev_limit);
// Call depth represents nested v8 api calls.
inline void IncrementCallDepth() {call_depth_++;}
inline void DecrementCallDepth() {call_depth_--;}
inline bool CallDepthIsZero() { return call_depth_ == 0; }
// Microtasks scope depth represents nested scopes controlling microtasks
// invocation, which happens when depth reaches zero.
inline void IncrementMicrotasksScopeDepth() {microtasks_depth_++;}
inline void DecrementMicrotasksScopeDepth() {microtasks_depth_--;}
inline int GetMicrotasksScopeDepth() { return microtasks_depth_; }
// Possibly nested microtasks suppression scopes prevent microtasks
// from running.
inline void IncrementMicrotasksSuppressions() {microtasks_suppressions_++;}
inline void DecrementMicrotasksSuppressions() {microtasks_suppressions_--;}
inline bool HasMicrotasksSuppressions() { return !!microtasks_suppressions_; }
#ifdef DEBUG
// In debug we check that calls not intended to invoke microtasks are
// still correctly wrapped with microtask scopes.
inline void IncrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_++;}
inline void DecrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_--;}
inline bool DebugMicrotasksScopeDepthIsZero() {
return debug_microtasks_depth_ == 0;
}
#endif
inline void set_microtasks_policy(v8::MicrotasksPolicy policy);
inline v8::MicrotasksPolicy microtasks_policy() const;
inline void EnterContext(Handle<Context> context);
inline void LeaveContext();
inline bool LastEnteredContextWas(Handle<Context> context);
// Returns the last entered context or an empty handle if no
// contexts have been entered.
inline Handle<Context> LastEnteredContext();
inline void EnterMicrotaskContext(Handle<Context> context);
inline void LeaveMicrotaskContext();
inline Handle<Context> MicrotaskContext();
inline bool MicrotaskContextIsLastEnteredContext() const {
return microtask_context_ &&
entered_context_count_during_microtasks_ == entered_contexts_.size();
}
inline void SaveContext(Context* context);
inline Context* RestoreContext();
inline bool HasSavedContexts();
inline DetachableVector<Object**>* blocks() { return &blocks_; }
Isolate* isolate() const { return isolate_; }
void ReturnBlock(Object** block) {
DCHECK_NOT_NULL(block);
if (spare_ != nullptr) DeleteArray(spare_);
spare_ = block;
}
private:
void ResetAfterArchive() {
blocks_.detach();
entered_contexts_.detach();
saved_contexts_.detach();
microtask_context_ = nullptr;
entered_context_count_during_microtasks_ = 0;
spare_ = nullptr;
last_handle_before_deferred_block_ = nullptr;
call_depth_ = 0;
}
void Free() {
DCHECK(blocks_.empty());
DCHECK(entered_contexts_.empty());
DCHECK(saved_contexts_.empty());
DCHECK(!microtask_context_);
blocks_.free();
entered_contexts_.free();
saved_contexts_.free();
if (spare_ != nullptr) {
DeleteArray(spare_);
spare_ = nullptr;
}
DCHECK_EQ(call_depth_, 0);
}
void BeginDeferredScope();
DeferredHandles* Detach(Object** prev_limit);
Isolate* isolate_;
DetachableVector<Object**> blocks_;
// Used as a stack to keep track of entered contexts.
DetachableVector<Context*> entered_contexts_;
// Used as a stack to keep track of saved contexts.
DetachableVector<Context*> saved_contexts_;
Context* microtask_context_;
Object** spare_;
int call_depth_;
int microtasks_depth_;
int microtasks_suppressions_;
size_t entered_contexts_count_;
size_t entered_context_count_during_microtasks_;
#ifdef DEBUG
int debug_microtasks_depth_;
#endif
v8::MicrotasksPolicy microtasks_policy_;
Object** last_handle_before_deferred_block_;
// This is only used for threading support.
HandleScopeData handle_scope_data_;
void IterateThis(RootVisitor* v);
char* RestoreThreadHelper(char* from);
char* ArchiveThreadHelper(char* to);
friend class DeferredHandles;
friend class DeferredHandleScope;
friend class HandleScopeImplementerOffsets;
DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer);
};
class HandleScopeImplementerOffsets {
public:
enum Offsets {
kMicrotaskContext = offsetof(HandleScopeImplementer, microtask_context_),
kEnteredContexts = offsetof(HandleScopeImplementer, entered_contexts_),
kEnteredContextsCount =
offsetof(HandleScopeImplementer, entered_contexts_count_),
kEnteredContextCountDuringMicrotasks = offsetof(
HandleScopeImplementer, entered_context_count_during_microtasks_)
};
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HandleScopeImplementerOffsets);
};
const int kHandleBlockSize = v8::internal::KB - 2; // fit in one page
void HandleScopeImplementer::set_microtasks_policy(
v8::MicrotasksPolicy policy) {
microtasks_policy_ = policy;
}
v8::MicrotasksPolicy HandleScopeImplementer::microtasks_policy() const {
return microtasks_policy_;
}
void HandleScopeImplementer::SaveContext(Context* context) {
saved_contexts_.push_back(context);
}
Context* HandleScopeImplementer::RestoreContext() {
Context* last_context = saved_contexts_.back();
saved_contexts_.pop_back();
return last_context;
}
bool HandleScopeImplementer::HasSavedContexts() {
return !saved_contexts_.empty();
}
void HandleScopeImplementer::EnterContext(Handle<Context> context) {
entered_contexts_.push_back(*context);
entered_contexts_count_ = entered_contexts_.size();
}
void HandleScopeImplementer::LeaveContext() {
entered_contexts_.pop_back();
entered_contexts_count_ = entered_contexts_.size();
}
bool HandleScopeImplementer::LastEnteredContextWas(Handle<Context> context) {
return !entered_contexts_.empty() && entered_contexts_.back() == *context;
}
void HandleScopeImplementer::EnterMicrotaskContext(Handle<Context> context) {
DCHECK(!microtask_context_);
microtask_context_ = *context;
entered_context_count_during_microtasks_ = entered_contexts_.size();
}
void HandleScopeImplementer::LeaveMicrotaskContext() {
microtask_context_ = nullptr;
entered_context_count_during_microtasks_ = 0;
}
// If there's a spare block, use it for growing the current scope.
internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() {
internal::Object** block =
(spare_ != nullptr) ? spare_
: NewArray<internal::Object*>(kHandleBlockSize);
spare_ = nullptr;
return block;
}
void HandleScopeImplementer::DeleteExtensions(internal::Object** prev_limit) {
while (!blocks_.empty()) {
internal::Object** block_start = blocks_.back();
internal::Object** block_limit = block_start + kHandleBlockSize;
// SealHandleScope may make the prev_limit to point inside the block.
if (block_start <= prev_limit && prev_limit <= block_limit) {
#ifdef ENABLE_HANDLE_ZAPPING
internal::HandleScope::ZapRange(prev_limit, block_limit);
#endif
break;
}
blocks_.pop_back();
#ifdef ENABLE_HANDLE_ZAPPING
internal::HandleScope::ZapRange(block_start, block_limit);
#endif
if (spare_ != nullptr) {
DeleteArray(spare_);
}
spare_ = block_start;
}
DCHECK((blocks_.empty() && prev_limit == nullptr) ||
(!blocks_.empty() && prev_limit != nullptr));
}
// Interceptor functions called from generated inline caches to notify
// CPU profiler that external callbacks are invoked.
void InvokeAccessorGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info,
v8::AccessorNameGetterCallback getter);
void InvokeFunctionCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
v8::FunctionCallback callback);
class Testing {
public:
static v8::Testing::StressType stress_type() { return stress_type_; }
static void set_stress_type(v8::Testing::StressType stress_type) {
stress_type_ = stress_type;
}
private:
static v8::Testing::StressType stress_type_;
};
} // namespace internal
} // namespace v8
#endif // V8_API_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NightOwl.demo
{
public class CSharp
{
private readonly string _testField;
public string TestProperty { get; set; }
#region RegionTest
public string Getter => TestProperty;
public CSharp(string testField)
{
_testField = testField;
string text = $"{TestProperty} this is a text string";
int number = 1;
}
#endregion
/// <summary>
/// Hello this is an xml comment
/// </summary>
/// <param name="testParam">param comment</param>
/// <returns></returns>
public async Task<string> TestMethod(string testParam)
{
for(var i = 0; i <= 5; i++)
{
testParam.Trim();
_testField?.Trim();
var enumVal = (int)TestEnum.TestValue;
// Hello this is a normal comment
new List<string>().Where(c => c == "Test");
}
return await Task.FromResult(testParam);
}
}
public enum TestEnum
{
TestValue
}
}

View File

@@ -0,0 +1,11 @@
.someClass {
font-family: serif;
}
#someID {
background: yellow;
}
main {
margin-top: 20px;
}

View File

@@ -0,0 +1,8 @@
main : Program Never Model Msg
main =
program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}

View File

@@ -0,0 +1,62 @@
import 'package:flutter/material.dart' as material;
void main(){
runApp(
new MaterialApp(
home: new MyButton(),
)
);
}
class MyButton extends StatefulWidget{
@override
MyButtonState createState() => new MyButtonState();
}
class MyButtonState extends State<MyButton>{
String flutterText = "";
List<String> collection = ['Flutter', 'is', 'great'];
int index = 0;
void changeText(){
setState(
() {
flutterText = collection[index];
index++;
index = index % 3;
}
);
}
@override
Widget build(BuildContext context){
return new Scaffold(
appBar: new AppBar(
title: new Text("Stateful Widget"),
backgroundColor: Colors.orangeAccent,
),
body: Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
flutterText,
style: new TextStyle(fontSize: 40.0)
),
new Padding(
padding: new EdgeInsets.all(10.0)
),
new RaisedButton(
child: new Text(
"Update",
style: new TextStyle(color: Colors.white)
),
color: Colors.blueAccent,
onPressed: changeText,
)
],
)
)
);
}
}

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">Tacos Tacos</div>
<p>Tacos tacos tacos</p>
<!--comment-->
<script>
var x = '100';
x.toString();
</script>
</body>
</html>

View File

@@ -0,0 +1,29 @@
import React from 'react'
import calculate from '../logic/calculate'
import './App.css'
import ButtonPanel from './ButtonPanel'
import Display from './Display'
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
total: null
}
}
handleClick = buttonName => {
this.setState(calculate(this.state, buttonName))
}
render() {
return (
<div className="component-app">
Tacos
<Display value={this.state.next || this.state.total || '0'} />
<ButtonPanel clickHandler={this.handleClick} />
</div>
)
}
}
export default App

View File

@@ -0,0 +1,29 @@
import React from 'react'
import calculate from '../logic/calculate'
import './App.css'
import ButtonPanel from './ButtonPanel'
import Display from './Display'
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
total: null
}
}
handleClick = buttonName => {
this.setState(calculate(this.state, buttonName))
}
render() {
return (
<div className="component-app">
Tacos
<Display value={this.state.next || this.state.total || '0'} />
<ButtonPanel clickHandler={this.handleClick} />
</div>
)
}
}
export default App

View File

@@ -0,0 +1,73 @@
'use strict'
class Sale {
constructor(price) {
;[this.decoratorsList, this.price] = [[], price]
}
decorate(decorator) {
if (!Sale[decorator]) throw new Error(`decorator not exist: ${decorator}`)
this.decoratorsList.push(Sale[decorator])
}
getPrice() {
for (let decorator of this.decoratorsList) {
this.price = decorator(this.price)
}
return this.price.toFixed(2)
}
static quebec(price) {
// this is a comment
return price + price * 7.5 / 100
}
static fedtax(price) {
return price + price * 5 / 100
}
}
let sale = new Sale(100)
sale.decorate('fedtax')
sale.decorate('quebec')
console.log(sale.getPrice()) //112.88
getPrice()
//deeply nested
async function asyncCall() {
var result = await resolveAfter2Seconds();
}
const options = {
connections: {
compression: false
}
}
for (let i = 0; i < 10; i++) {
continue;
}
if (true) { }
while (true) { }
switch (2) {
case 2:
break;
default:
break;
}
class EditFishForm extends Component {
static propTypes = {
updateFish: PropTypes.func,
deleteFish: PropTypes.func,
index: PropTypes.string,
fish: PropTypes.shape({
image: PropTypes.string,
name: PropTypes.string.isRequired
})
}
}

View File

@@ -0,0 +1,14 @@
{
"env": {
"es6": true,
"mocha": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}

View File

@@ -0,0 +1,26 @@
# Night Owl Theme
> Night Owl theme for VS Code.
![Preview](images/preview.gif)
# Installation
1. Install [Visual Studio Code](https://code.visualstudio.com/)
2. Launch Visual Studio Code
3. Choose **Extensions** from menu
4. Search for `night-owl`
5. Click **Install** to install it
6. Click **Reload** to reload the Code
7. File > Preferences > Color Theme > **Night Owl**
-[ ] check check 12 12
-[ ] check check 12 12
Heading 1
========
Heading 2
--------------
### Heading 3

View File

@@ -0,0 +1,36 @@
<?php
class HelloWorldTest extends PHPUnit_Framework_TestCase
{
/**
* @var PDO
*/
private $pdo;
public function setUp()
{
$this->pdo = new PDO($GLOBALS['db_dsn'], $GLOBALS['db_username'], $GLOBALS['db_password']);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->pdo->query("CREATE TABLE hello (what VARCHAR(50) NOT NULL)");
}
public function tearDown()
{
$this->pdo->query("DROP TABLE hello");
}
public function testHelloWorld()
{
$helloWorld = new HelloWorld($this->pdo);
$this->assertEquals('Hello World', $helloWorld->hello());
}
public function testHello()
{
$helloWorld = new HelloWorld($this->pdo);
$this->assertEquals('Hello Bar', $helloWorld->hello('Bar'));
}
public function testWhat()
{
$helloWorld = new HelloWorld($this->pdo);
$this->assertFalse($helloWorld->what());
$helloWorld->hello('Bar');
$this->assertEquals('Bar', $helloWorld->what());
}
}
?>

View File

@@ -0,0 +1,68 @@
<#
.SYNOPSIS
Provisions a example powershell function
.EXAMPLE
PS C:\> .\powershell.ps1 -Argument1 "hola soy un texto"
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, HelpMessage = "This argument is required")]
[String]
$textParameter
)
try {
#almost every function is called like this:
Write-Host "Initializing example function"
Write-Host "The parameter is " $textParameter -ForegroundColor Red
#this are variables
$customArray = @(
@{
Id = 1;
Value = "I'm an option";
},
@{
Id = 2;
Value = "Option No. 2";
}
)
foreach ($option in $customArray) {
Write-Host "Iterating options:" $option.Value
}
$collectionWithItems = New-Object System.Collections.ArrayList
$temp = New-Object System.Object
$temp | Add-Member -MemberType NoteProperty -Name "Title" -Value "Custom Object Title 1"
$temp | Add-Member -MemberType NoteProperty -Name "Subject" -Value "Delegación del plan de acción [Folio_PlandeAccion]"
$temp | Add-Member -MemberType NoteProperty -Name "Body" -Value "<div>This s a note example, with lots of text</div>
<div> <br/>&#160;</div>
<div>It happens to be in html format, but is just text the property couldnt't know<br/></div>
<div><br/>&#160;<br/></div>
<div>It's up for the one who uses me to render me correctly. <a href='/ligaPlanAccion'>Or not.</a></div>"
$collectionWithItems.Add($temp) | Out-Null
Write-Host "My collection has" $collectionWithItems.Count "item(s)" -ForegroundColor Green
#Calling some other scripts. Sometimes its nice to have a "master" script and call subscripts with other functions / actions
.\otherscript.ps1 "Parameter ?"
.\thisonewithoutparams.ps1
#little bit of SharePoint *the original issue* :D
$web = Get-SPWeb http://mysharepointsite
$list = $web.Lists["ListName"]
$query = New-Object Microsoft.SharePoint.SPQuery
$query.Query= "CAMLQuery here"
$query.ViewFields= "<FieldRef Name='ID'/><FieldRef Name='Title'/>"
$query.ViewFieldsOnly= $true
$listitems = $list.GetItems($query);
foreach($item in $listitems) {
if($item -ne $null) {
Write-Host "There is an elmeent in the list, id" $item.ID
}
}
}
catch {
Write-Host -ForegroundColor Red "Exception Type: $($_.Exception.GetType().FullName)"
Write-Host -ForegroundColor Red "Exception Message: $($_.Exception.Message)"
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
html(lang="en")
head
meta(charset="UTF-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
meta(http-equiv="X-UA-Compatible", content="ie=edge")
title Document
body
h1 Pug

View File

@@ -0,0 +1,34 @@
from collections import deque
def topo(G, ind=None, Q=[1]):
if ind == None:
ind = [0] * (len(G) + 1) # this is a comment
for u in G:
for v in G[u]:
ind[v] += 1
Q = deque()
for i in G:
if ind[i] == 0:
Q.append(i)
if len(Q) == 0:
return
v = Q.popleft()
print(v)
for w in G[v]:
ind[w] -= 1
if ind[w] == 0:
Q.append(w)
topo(G, ind, Q)
class SomeClass:
def create_arr(self): # An instance method
self.arr = []
def insert_to_arr(self, value): #An instance method
self.arr.append(value)
@classmethod
def class_method(cls):
print("the class method was called")

View File

@@ -0,0 +1,31 @@
import React from 'react';
import calculate from '../logic/calculate';
import './App.css';
import ButtonPanel from './ButtonPanel';
import Display from './Display';
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
total: null,
next: null,
operation: null
}
}
handleClick = buttonName => {
this.setState(calculate(this.state, buttonName))
}
render() {
return (
<div className="component-app">
Tacos
<Display value={this.state.next || this.state.total || '0'} />
<ButtonPanel clickHandler={this.handleClick} />
</div>
)
}
}
export default App

View File

@@ -0,0 +1,20 @@
import React, { useState, useEffect } from 'react';
function Example() {
const [count, setCount] = useState(0);
// Similar to componentDidMount and componentDidUpdate:
useEffect(() => {
// Update the document title using the browser API
document.title = `You clicked ${count} times`;
});
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);
}

View File

@@ -0,0 +1,96 @@
module ExampleModule
class ExampleClass::ScopeResolution < NewScope::Operator
include Another::Scoped::Module
def initialize(options)
@@class_var = options[:class]
@instance_var = options[:instance]
config.data = []
config.actions = []
new.run
end
def method_examples
method_with_args(:arg)
method_no_args
# method defined on base ruby object
method(:array_access)
end
def array_access
array = ([1, 2] << 3).uniq
array[1]
array[dynamic_key]
end
def blocks
yield if block_given?
[1].each do |num|
do_something
end
[2].each { |num| do_something }
lambda { do_something }
->(arg1) { do_something}
Proc.new { |arg| do_something }
end
def hash_access
symbol_hash = {
key1: 'info',
key2: 'info',
}.compact
string_hash = {
method_key => 'info',
'key2' => 'info',
}
symbol_hash[:key1]
string_hash['key2']
end
def output
puts 'Output here'
pp 'Output here'
end
def self.class_method
return "I am a class method!"
end
class << self
def another_private_method(arg1, default_arg = {}, **args, &block); end
end
private
def other_method(*args)
puts "doing other stuff #{42}"
end
def self.private
[1, 2, 3].each do |item|
puts item
end
end
private_class_method :private
private
def user_params
params.require(:user).permit(:username, :email, :password)
params.pluck(:user)
end
end
end
ExampleModule::ExampleClass::ScopeResolution
example_instance = ExampleModule::ExampleClass::ScopeResolution.new(:arg)
example_instance.method(:arg) do
puts 'yielding in block!'
end

View File

@@ -0,0 +1,35 @@
// I use this syntax when my component fits on one line
const ListItem = props => <li className="list-item">{props.item.name}</li>
// I use this when my component has no logic outside JSX
const List = ({ items }) => (
<ul className="list">{items.map(item => <ListItem item={item} />)}</ul>
)
// I use this when the component needs logic outside JSX.
const Body = props => {
let items = transformItems(props.rawItems)
return (
<div>
<h1>{props.header}</h1>
<List items={items} />
</div>
)
}
const Foo = () => <div>
<div></div>
</div>
// This is equivalent to the last example
function Page(props, context) {
return (
<div>
<Body header="My List" rawItems={props.rawItems} />
</div>
)
}
// propTypes and contextTypes are supported
Page.propTypes = {
rawItems: React.PropTypes.array.isRequired
}

View File

@@ -0,0 +1,16 @@
.someClass {
font-family: serif;
}
#someID {
background: yellow;
}
main {
margin-top: 20px;
}
.someotherclass {
padding: 20px;
box-shadow: 0 0 0 2px inset;
}

View File

@@ -0,0 +1,44 @@
import { Component, OnInit, OnDestroy } from '@angular/core'
import { Person, SearchService } from '../shared'
import { ActivatedRoute } from '@angular/router'
import { Subscription } from 'rxjs'
@Component({
selector: 'app-search',
templateUrl: './search.component.html',
styleUrls: ['./search.component.css']
})
export class SearchComponent implements OnInit, OnDestroy {
query: string
searchResults: Array<Person>
sub: Subscription
constructor(
private searchService: SearchService,
private route: ActivatedRoute
) {}
ngOnInit() {
this.sub = this.route.params.subscribe(params => {
if (params['term']) {
this.query = decodeURIComponent(params['term'])
this.search()
}
})
}
search(): void {
this.searchService.search(this.query).subscribe(
(data: any) => {
this.searchResults = data
},
error => console.log(error)
)
}
ngOnDestroy() {
if (this.sub) {
this.sub.unsubscribe()
}
}
}

View File

@@ -0,0 +1,46 @@
<template>
<div>
<AppSelect />
<button
@click="getNewIntent"
:class="{ disabled: uiState === 'listening' }"
></button>
</div>
</template>
<script>
export default {
props: {
aborted: {
type: Boolean,
default: false,
required: true,
},
},
computed: {
uiState() {
return this.$store.state.uiState;
},
},
methods: {
getNewIntent() {
this.$store.dispatch("getSpeech");
this.$emit("isaborted", false);
},
},
};
</script>
<style scoped>
button {
border-radius: 1000px;
background: teal;
margin-top: 10px;
transition: 0.3s all ease-out;
}
button.disabled {
background: #ccc;
cursor: none;
}
</style>

View File

@@ -0,0 +1,13 @@
language: node_js
node_js:
- "6"
install:
- npm install
script:
- npm test
after_script:
- npm run coveralls
notifications:
email:
on_success: never
on_failure: always