ECMAScript (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms and stand-alone interpreters / JIT engines. Use this tag for questions regarding ECMAScript 5 or 6 and its dialects / implementations: JavaScript, JScript, etc., excluding ...
0
votes
0answers
10 views
Simple factory for CRUD operations on Sqlite using Javascript and Q
I have written this implementation and I would love to make it more efficient.
While I am indeed requesting a code review/suggestion, I would also love to get feedback on readability and coding style....
0
votes
0answers
9 views
Login and Pay with Amazon [on hold]
Right now i have integrated Login with Amazon using the below code where it pulled out name,email,customerId like this :-
...
0
votes
0answers
17 views
A (possibly) great Polymer autocomplete widget
I have just finished writing this:
https://github.com/mercmobily/hot-autocomplete
This is the source at the time of me writing this post:
https://github.com/mercmobily/hot-autocomplete/blob/...
0
votes
1answer
28 views
List and post tasks with jQuery
I've written the code below to display a list of tasks from a Flask API. The form and associated .ajax method post to the API, immediately appending the data to the list of tasks. The code is working, ...
0
votes
0answers
6 views
Retrieving data from MySQL database to display in Google-Maps infowindow [on hold]
I'm using Google Maps API V3 to make a map where people can click to add a marker and save a form in the infowindow that pops up. This data is then stored in a database, but I don't know how to access ...
1
vote
1answer
39 views
Pixel manipulation performance
I have created a function that adds "shadow" to the content of a canvas. The algorithm for adding shadow follows these rules:
If the either x or ...
1
vote
3answers
342 views
Determine if requested documents exist and if they do, whether they match requested revision number
Is there a better way than using 2 for loops and 2 if statements deep?
jsfiddle:
https://jsfiddle.net/bobbyrne01/bmnk9bLz/
...
0
votes
0answers
20 views
Horizontal scroll buttons with inertia [on hold]
For users that have just a normal mouse, and perhaps a vertical scroll wheel, horizontal scrolling a row of items feels clunky. So I started work on scroll-buttons that live on either side of the ...
-4
votes
0answers
23 views
Factory pattern in javascript [on hold]
I am a novice javascript programmer.
I am trying to create a wrapper around a javascript library which does the terminal emulation. I want to use a factory pattern to construct the variable ...
0
votes
0answers
15 views
Javascript parallax mouse over [on hold]
I'm trying to make parallax header which one move only left-right. I have code for that but windows move on X,Y offset.
So can you guy help me how to do it only for X offset?
...
0
votes
0answers
15 views
React Native - Combining Login and Signup Pages Into One Component
I have been building an app in React Native and have decided that since my Login and Signup components share much of the same ...
0
votes
1answer
36 views
Wait for a “3rd party” element to be appended to the DOM
Let's say we're writing a user script which interacts with a 3rd party site we don't control. We want to open a menu, so we trigger a click on the button and then wait 10ms before accessing the menu (...
11
votes
1answer
87 views
Wandering water ways
An entry for the August 2016 Community Challenge
I slightly modified the input and output to suit the snippet tool, and also because I really like the mapped output with the basins.
I have been ...
6
votes
2answers
57 views
Codility binary gap solution using regex
This is how I solved the binary gap problem:
Find longest sequence of zeros, bounded by ones, in binary representation of an integer.
However, it seems to be different from the answers out there. Is ...
3
votes
1answer
56 views
My Quick sort examination
I had a test on sorting using quick sort algorithm, which I have implemented. It's working fine.
But my examiner is not satisfied. They say that the solution which I provided is not a proper ...
5
votes
1answer
84 views
Random quote generator from API
I have built a random machine generator website. It fetches the quotes from forismatic and has a button to get a new quote. When it gets a new quote, the website color changes. It also features a ...
3
votes
3answers
64 views
Binary search that gets ALL matching results
I am implementing a binary search to retrieve all matches of a specified value. Instead of a regular binary search that would just return the first match, I want to get that first match AND all ...
2
votes
1answer
62 views
Displaying dynamic fields for Trac tickets
TLDR: Rendering is too slow when having lots of custom fields and rules. So I need help to improve this javascript code.
#9606: Trac ticket about issue
I have a trac 1.0.8 installed on a ubuntu ...
2
votes
0answers
38 views
Drawing app with JS / canvas
Created this drawing app with JS / canvas. JSHint is throwing errors but the app works just fine. Need help with code clean up / refactoring as I'm fairly new to JavaScript.
JSHint in Atom is fine ...
1
vote
0answers
26 views
Angular 1.x Data Connector Service
I've been writing in Angular 1.x for about a year now but I always wonder about my structure and performance as I'm self taught and in a very small team with limited time for code reviews.
This ...
1
vote
2answers
57 views
Generating random numbers and decks of cards
So I have some code here:
First a simple random # generator and a array-choosing function:
...
4
votes
1answer
71 views
Converting a Website Into a Single Page App
I want to convert my website into a single page app. This function does the trick:
...
0
votes
0answers
18 views
Why does my script throw an error when I send successive requests in a short time? [on hold]
My code work as well and all fine.
I have a question and answer like stackoverflow. Following codes are for marking an answer as accepted one part. As I said it works perfectly, but sometimes it ...
3
votes
1answer
46 views
javascript - create an object containing objects based on JSON data
Based on JSON data I receive, I am trying to track a team's home and away games. The JSON data is stored in $scope.gameSchedules and has "team1" for home games and "...
5
votes
3answers
305 views
Button click handlers for a JavaScript text-based adventure game
I'm pretty new to JavaScript, and I'm trying to created a text-based game. I've written a few scenarios and based on the player's decision I have different scenarios written out. As of now I have the ...
1
vote
2answers
38 views
Function for getting strings consisting of random characters
I've made this function for to be used while testing.
...
8
votes
4answers
2k views
Regex to enforce password requirements
I'm trying to write regex to validate the password for the given rule.
Passwords must be at least 8 characters in length and contain at least 3 of the following 4 types of characters:
lower case ...
6
votes
1answer
76 views
My tetris implementation
I just wrote a tetris game and I'd like to humbly request for code review especially in terms of code transparency, code efficiency (whether something can be coded in faster way using less resources) ...
1
vote
0answers
13 views
React Native - Rendering different scenes based on application state
I am using react-native-router-flux to organize the routes for my application. Using Firebase, I am able to call ...
4
votes
2answers
41 views
Library system manager
I'm new to JavaScript OOP and still playing around with it. I have put together a few specific questions over specific details throughout the code that are bothering me.
I wanted my ...
4
votes
2answers
180 views
Person Info Manager
In the process of teaching myself JavaScript. Starting to branch off into OOP designs and did not want to continue until I knew I was doing it correctly.
Is this a common or accepted way of ...
0
votes
0answers
31 views
A very basic inventory app with search in Angular2
So, I have been learning TypeScript and Angular2 and I came up with this:
...
1
vote
2answers
33 views
Check if an Array of Arrays contains a value in node js
In C#, I could check if any of the nested List collection has a value. Example of such structure Check a List[]> contains a value using Linq
...
2
votes
1answer
66 views
Check deep object property and find duplicate value
I use the following code to find if there is duplicate value in property path:
...
3
votes
1answer
39 views
1
vote
2answers
47 views
JavaScript modular framework for a large web-site
In my ASP.NET MVC project I simply inserted <script></script> into my views - it caused code duplications and spaghetti code.
Now, I have decided to ...
4
votes
1answer
50 views
DRYing a stateless functional builder
This was just an experiment to see if it was possible to build a stateless builder in ES6. I was able to do it, but when I took it a step further I got stuck trying to DRY it out.
In this case, we ...
2
votes
2answers
137 views
Defining an OOP structure for a Student class in NodeJS
Most of my coding experience is in C#. The way object oriented programming is laid out in C# is a bit different from NodeJS, hence this is my first NodeJS OOP for a ...
1
vote
0answers
20 views
Emulating the React.js createElement function
I am trying to create a helper function for myself, and this helper should do the following:
Create an element
Add properties to the element
Set values to the element (this is the concern of my ...
0
votes
1answer
40 views
Angular template for a dropdown menu
I'm ashamed to ask such an elementary question but I tried to DRY up this template a couple ways and couldn't come up with anything I was satisfied with. Can you help?
...
0
votes
2answers
72 views
Looping over an array using $.each
The code below contains an array of objects that I loop over and append to hidden input fields in the DOM. As these inputs have no ID, I first select them by name using ...
1
vote
1answer
29 views
Promise Chaining for a Firebase v3 Auth Subsystem - Password Based Users
Firebase v3 Offers Authentication via 3rd party oAuth providers, facebook, github,google, and twitter. They also offer password pased authentication.
Authenticated users have a firebase.User object ...
4
votes
0answers
48 views
A dice roller in node.js
I knocked out a dice roller in 2 days. I think this is the first coding project I've ever actually completed to a degree where I'm not embarrassed to post it.
This is my first time working with ...
0
votes
1answer
39 views
Binary to decimal converter in JavaScript
This exercise with a test suite is from here. I did not intend to use ES6 features, it's plain old JavaScript. That's why I seek advice more on the good practices, performance side, than modern syntax....
3
votes
1answer
52 views
Ribbon animation code too repetitive
I spent the last two days getting a ribbon animation to work with divs so that I can later add li link elements to them to act as a menu. I used the progess bar animation code as inspiration from ...
4
votes
1answer
74 views
Javascript contact form validation code
I'm a UI / UX Designer trying to sharpen my JS skills. I wanted someone else to check this code snippet and maybe have a Pro tip to improve or shorten it.
Javascript:
...
5
votes
0answers
40 views
Mocking config data in JavaScript unit tests
I'd really like someone to sanity check my approach for unit testing the summarise() function and mocking its dependencies.
Background
Each option has a set of ...
1
vote
1answer
64 views
Which jQuery click solution is better? [closed]
I am here at my workplace, and we have a very passionate debate with my colleague about $().click() method vs onclick.
I will ...
1
vote
2answers
54 views
Printing staircase revisited
What can be more elegant ways to solve the given problem.
#
##
###
####
Code:
...
1
vote
2answers
58 views
Selection sort algorithm examination
I had an algorithm test.
I was asked Selection sort algorithm to program.
I coded it in javascript and shown to examiner.
But he was not satisfied, he said its too complicated.
I think I have ...