instruction
stringlengths
71
71.9k
I am trying to do some translation of text files. I have a translation .csv file and a file I need to translate (tab delimited). The translation is creating a file with an extra column of the translation. I'd like to hear any suggestions on this. import com.google.common.base.Joiner; import com.google.common.base.Split...
I am working on an MVC solution. My DAL layer I could solve with Repository classes, everything is working great. But in my BLL layer I have repetitive code: My CRUD is the same, my fields and consructor are different. I can also have some extra methods. Is there a way to solve this properly? Class 1 public class JobT...
I need to have some thread-safe event handler (like C#'s EventHandler), so I made one. Here is my event handler class and sample code (compiled with VS2013). Is this code OK to be operated in multithreaded environment? #include <functional> #include <memory> #include <atomic> #include <list> #include <conio.h> ///////...
I'm trying to find a way to make my code easeier to read, so i found that major part of the code is validation trough if, ifelse: if (!$this -> is_valid_username($username)) { $this -> Session -> setFlash('Enter valid client username, Error 1.', 'default', array(), 'errorlogaddclient'); $this -> red...
I'm learning PHP and I know too many ways to configure the application. I use this method: Folder: app config app.php db.php src class.php index.php File: // app.php return [ 'environment' => 'development', 'meta' => [ 'description' => 'Description', 'title' => 'Title'...
I need to create a sparse Markov chain. It is supposed to receive text, so the number of rows or columns can easily go up to 20000. Besides, if I want to consider higher orders of the Markov chain (creating pairs of consecutive words) the dimension can become much bigger. Hence the need to have something sparse. I adde...
class Class1 { private bool _noise = false; private bool _cmbGrammageSelected = false; private bool _cmbSize1Selected = false; private bool _cmbSize2Selected = false; private static refine() The Section below was my trying to refactor, but I did not want to convert the ot...
This code processes a basic contact form with a name, email and message. It also asks for a code to be typed in. The data is then transformed to avoid malicious placing of HTML script on the server, and if the name and email are valid, sent to my email. Is this code really secure against the attempt to place malicious ...
The GetDropdownList() function is being called on a couple of controllers based on this example and it may be called in many other controllers, so this code is being repeated. I was thinking of encapsulating this portion of code to the base class and call that base class in these controllers, but I got stuck and don't ...
In a Java/JPA project I usually define a base class (on which I put the id). The goal is to implement an generic toString() on this base class (named BaseEntity) from which all other entities inherit. We played around with apache commons ReflectionToStringBuilder, but we ran into problems because of cyclic references a...
I'm making some changes to a page on a WebBrowser Control. There is some indications in the code. I just want to make sure that I don't have any unnecessary lines of code. namespace AL4 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } ...
I'm trying to solve a problem that asks for a shortest path between two cities with at most k nodes. The first line of input has the number of test cases. On the second line 3 integers are given, which are respectively, the number of nodes, the number of edges and the maximum number of nodes in the shortest path. After...
Explanation is in the function. Please point out any egregious errors: create function api.ConstantTimeCompare ( @x varbinary(8000) = 0x00 , @y varbinary(8000) = 0x00 ) /* What? Compares two variable length binary strings byte by byte in constant time. When? Cryptography. Why? Given the strings 0...
I'm wondering if there is a way to make my code more efficient? Perhaps by using loops or something similar? I have posted the code below. Please tell me how I can make it more efficient. P.S.: I'm new to Java programming so no hate please :) final TextView textview = (TextView) findViewById(R.id.textView); final Text...
I'm learning Python & practising from this site and here is the particular problem at hand: Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the largest and smallest values in the array. If there are multiple copies of the smallest value, ignore jus...
I posted a question a while back asking for some feedback on the code of a game I made (it was limited to typing the input and drawing the output in ASCII). Now I've got it linked up with pygamef. Does anything look out of place? Do you notice any bugs? Do the colours work? Is there anything particularly annoying? Use ...
I have a requirement to put a comma between each digit of a number in a Java string. Example input: the number is 12345 and the number is 45678 The output should be: the number is 1,2,3,4,5 and the number is 4,5,6,7,8 I wrote the following and I am not sure if it is optimized. If someone reviews it and help me fi...
I have a directive called meetingList with its own isolated scope that receives a list of meetings and displays the filtered items based on some criteria. The controller for this directive holds two variables the meetingList and the filteredMeetingList. The scope where this directive is created needs to know how many i...
I created a basic background thread class in swift to replace the ugliness of: dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { () -> Void in // background thread code dispatch_async(dispatch_get_main_queue()) { () -> Void in // done, back to main thread } } with the expressi...
Is there anything I should add or change? Is it easy to follow? How could I shorten it? How can I improve the overall program to make it a program you would use on a regular basis? #Programmer: DeliriousMistakes #Date: 10-17-15 #File: password.py #This program lets you store and create passwords import random import...
I need some help condensing my Caesar Cipher (encryption and decryption). Encryption key = 8 f = open('unencrypted.txt','r+') lower = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" g = open('encryptedmessge','w') for line in f: s = list(line) ...
I have been writing some code (see component parts here and here) that: Takes a very large JSON (15GB gzipped, ~10million records) Extracts the relevant parts of the JSON into a list of lists Creates a list of all contiguous n-gram sub-lists found in the array Creates a counter to count the frequency of each n-gram Ou...
I decided to try make a version of the Game Of Life that'd be infinitely big. The idea was to store a dictionary of each Y value, which contain a set of X values (for fast lookup), as opposed to creating a 2D grid, and searching for the coordinate. I've no way if this idea would scale well or not since I've not done an...
I am new to coding and am working through Learn Python The Hard Way. I wrote a simple text game as instructed. The logic appears to be sound. I played through it and didn't run into any dead ends. I am simply looking for some pointers on how to make my code more neat, more readable, more efficient etc. I would lik...
Just getting up to speed in Ramda, I have implemented this: var R = require('ramda'); var divisibleBy = (b) => R.compose(R.equals(0), R.flip(R.modulo)(b)) var fizzbuzz = R.map(R.cond([ [R.both(divisibleBy(3), divisibleBy(5)), R.always('FizzBuzz')], [divisibleBy(3), R.always('Fizz')], [divisibleBy(5), R.always('B...
I have a fully working "Guess my number" game, in which the batch file will generate a random number between 0-whatever you choose. I got the idea from this thread, in which I had a rather hilarious conversation with a certain member. So I got bored tonight, and reworked the code a little, to show that member how this ...
This Question now has a follow-up here I don't think that there is any new technique in my code but in my opinion it's ok all in all (with a bit of magic). Maybe you can find something to improve or provide some hints on what's good and what's bad about this wrapper class. XoursWindow.h #ifndef __XOURSWINDOW_H #define ...
I'm fairly new to real world Java so I tried to rewrite an old app I wrote in vanilla java. I've made this one a lot more OO and used a dependency/build manager (Gradle). Now I just want to see what more experienced devs have to say about the project. This is the main code snippet that does most of the work. Any com...
I am learning about the binary tree data structure and implemented some basic functionality. It was working great with module level functions until I realized that I need to keep track of the root for operations like checking height. The simplest solution that I could possibly think was of creating a container class to...
I develop an application which installs updates. These updates have a version id (this version id is created as a part of the application and the format is a fixed requirement) and I use a regex to parse/validate their id. Each group must be separated by a dot. The id must have 2 digits in the first group, one or two d...
My fundamental problem is how to check whether byte[] is full of zeroes. I posted a range of implementations (with timings) and one clearly beats others. In fact, it is so fast that I am having trouble believing it even works. I suggest taking a look at SO question page first. This is the winner code: static unsafe boo...
I am trying to optimize my vertex and pixel shader code. Do you have any suggestions what could I possibly do to improve performance? I am using it to draw textured cuboids, and if there are many objects in the screen my framerate drops. VERTEX SHADER float4x4 WorldViewProj : register(c0); ...
I have an ASP.NET MVC 5 app and I map properties between model and viewmodel and vice versa. I could use automapper to do this but since I don't need mapping rules to convince me to use it as I mostly do simple 1 to 1 mapping the performance overhead that automapper will add is not worthwhile.If I have mapping differ...
I have a java code that is supposed to format the content of a .css file so that I could use the result to make a enum class. import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; class CreateCssEnum { public static void main(String[] args) throws IOException { BufferedRea...
How can I shorten this code with a while loop? Is it possible? cboFrom and cboTo is a combobox. I only know how to do simple while loops and I feel like it's a waste of time to write all the indexes and values of the combox down public int pay; private void Calculate_Click(object sender, EventArgs e) { int Th...
The application I am developing with has many input fields that interact with one another via the onchange event. When developing started, the goal was to create a framework that makes it easy to define event actions for the input fields and keep the action functions together. The back then the following was implemente...
I have an ASP.NET MVC 5 app and I map properties between model and viewmodel and vice versa. I could use automapper to do this but since I don't need mapping rules to convince me to use it as I mostly do simple 1 to 1 mapping the performance overhead that automapper will add is not worthwhile. If I have mapping differ...
I have a DataGrid that I filter when the user inputs text into a search box. The column that is filtered is based upon which radio button the user selects (Name, Town or Post Code). Although initially nothing happens until the user has started typing into the searchbox, for some reason there is a noticeable delay in se...
I have written a small module for accessing data on isotope masses and relative abundances. My long term aim is to build tools in Haskell for working with mass spectrometry data. Any comments on how to improve this module will be greatly appreciated. I am considering uploading this to Hackage, though I want to be sure ...
Write a program that reads two integers start and end from the user and prints the number from start to end inclusive. However, If end was less than start than you should print them in descending order. public static void main(String[] args) { Scanner scan = new Scanner(System.in); int start = scan.next...
I am developing a huge form with a lot of elements in it. The purpose of this form is editing one domain entity. Now, I finished developing the whole form and it just shows the bunch of text boxes, text areas, radio buttons and so on, allowing user to change values of entities. When user submits the form, it goes to se...
I recently submitted a code sample for a web scraping project and was rejected without feedback as to what they didn't like. The prompt, while I cannot give it here verbatim, basically stated that I needed to write a spider to crawl a site for product items. They suggested using a generic spider to scrape the site in q...
Consider the following code. Are the multiple assignments to the loc variable a code smell? If so, how can I refactor this? def set_locale begin loc = user_signed_in? ? user_locale : browser_locale loc = browser_locale if loc.nil? loc = param_locale if loc.nil? loc = I18n.available_locales.include?(lo...
This is a code written is Pascal (Delphi). It asks the user to think of a number between min_ and max_ and then guesses the number using either a Binary or a Linear method. program BandLSearch; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var min_, max_: integer; // set the max and min to c...
I am developing a website, where people can buy services, also it has a notification system; I do this in views to show log in and sign up, on index.html. views.py from django.middleware.csrf import get_token from app.models import * from app.forms import * from django.shortcuts import render, render_to_response from d...
Since I while ago I've been addicted to a number-game that you can think of as a binary Sudoku. The game is called (in Italian) Alberi (trees) and I haven't found any equivalent when searching the internet. The purpose of the game is to find where the trees are placed. The rules (that may vary with the puzzle) are tha...
So I wrote this code for a contest going on over at Khan Academy known as "Pixar in a Program". The goal of the contest is to create an entry that uses one of the skills shown in the new "Pixar in a Box" course made by them in their partnership with Disney Pixar. In my entry I used De Casteljau's algorithm to make a to...
A small script to calculate total units of distance between two vector entities. Especially useful in games and grid snaps, inventory snaps etc.. typedef struct COORD { int X, Y; } coord; int get_dist (coord entity1, coord entity2) { int minuendX = max(entity1.X, entity2.X); int minuendY = max(entity...
Single-page web app from Applet I'm seeking feedback on my first single-page web app using RequireJS and a web worker. I converted it from a Java applet, and the code is up on GitHub. It's a combat simulator based on the old-school (1977) game of Melee. The RequireJS design is based on jrburke's single page app templat...
The below code is a simple TCP echo server. The folks using it claim "it is going down every now and again". Any thoughts on how this could be improved would be really appreciated, particularly if they would improve the reliability. import select, argparse, socket def server_socket(ip, port): serv = socket.socket(...
As the title explains, this is a series of extension methods that convert certain numeric types to and from byte-arrays, for certain actions which work better on byte-array types than numeric types. Any and all suggestions are welcome, I am also attaching the Unit Tests. /// <summary> /// Provides extension methods to ...
I wanted to copy the behavior of github's pagination. Here is what it turned out: http://jsbin.com/dihohiseca/5/edit?js,output It works fine, but I have a feeling that there is a lot of room for improvements. Please help me make my code more elegant / shorter. var page = 12; var numPages = 40; var res = []; var fro...
I started with a pure python implementation, and have been trying to get the performance as close to native C as possible using numpy, numexpr, and cython. Here is the the numpy version that I compile with cython: import numpy as np cimport cython cimport numpy as np from cython.parallel cimport prange, parallel from ...
I'm writing a wordpress plugin that makes changes to the admin menu. To add some context: The wordpress global $menu is a multidimensional array. Each array in $menu represents a menu item, with the title, url, css classes etc at specific indexes in the array. the oa_custom_menu option is a similarly structured multid...
I have inherited a legacy ColdFusion app with gobs of <input type="hidden"> fields, and a user finally may have used F12/Inspect Element to submit a system-valid value in a hidden input that by rights was not supposed to be available. I have coded a session struct to hold the values server-side that used to be hidden i...
I'd want to see if is possible to optimize performance even further of the following generate color method. package generacolorrgb; import java.util.Random; public class GeneracolorRGB { /** * @param args the command line arguments */ public static void main(String[] args) { Random r = new ...
I've been working through some puzzles from exercism.io. Current puzzle asks me to return a date() from input that essentially says "The 3rd Friday of December" or "The 1st Monday of October". I'd love to hear some feedback on how to clean this code up: def meetup_day(year, month, weekday, spec_weekday): import cal...
This is a class which stores a function pointer and arguments to that function, to call/invoke that function at a later point in time, or multiple times. Additionally, through polymorphism, it allows methods with the same return type (though potentially different arguments) to be grouped (in a container) and invoked be...
Last week, I posted this question in order to get some comments and critiques on a simple implementation of a multidimensional array class -- hyper_array::array which was inspired by orca_array. I managed to fix a few issues that were mentioned by the comments and added some improvements. Goals I still have the same go...
I created a 2-player number guessing game. Each player picks a number between 1 and 10 and closest one wins. I'm just looking for best practices suggestions and improvements. Console program.cs using ClassLibrary1; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Thread...
I need to extract some data from the environment variables using Go. This data can be string, boolean or integer, so I ended up writing three functions. package main import ( "fmt" "os" "strconv" ) func getStrEnv(key string) string { val := os.Getenv(key) if val == "" { panic(fmt.Sprintf("s...
Here is working code to get N closest points to some reference point. Please help to improve it, specifically by commenting on my use of std algorithms and vectors/iterators manipulations. Nearest.h #pragma once #include <iostream> #include <algorithm> #include <cmath> #include <vector> namespace nearest { struct P...
<?php define('AES_256_CBC', 'aes-256-cbc'); // both stored in a file on server $encryption_key = openssl_random_pseudo_bytes(32); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(AES_256_CBC)); $user_id = 1123; $exp = time() + (365 * 24 * 60 * 60); $data = [ "user_id" => $user_id, "exp" ...
It takes my code over 700 seconds to solve simple puzzle: 2 7 11 5 13 0 9 4 14 1 8 6 10 3 12 15 My function findSolution(puzzle, minH) takes puzzle as an array and minimal h parameter which has to be found. I'm using A* with Manhattan Distance heuristic function. G is step number and h is Manhattan Distance. ...
This ObjectSet container adds new Objects with lowest possible unique ID. My implementation uses std::set for its sorting, but this convenience may not be required. My two main questions are: Is std::set generally a good and preferred solution for this problem? In case of using std::set, can ObjectSet::minId be implem...
Simple function which returns a text representation for numbers in range [1...1000]. N100 = 'hundred' N1000 = 'one thousand' N1_9 = [ 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', ] N10_19 = [ 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'sev...
I read the following question: Searching an element in a sorted array and I thought that I could give it a try in Python. Given a sorted list of integers and an integer. Return the (index) bounds of the sequence of this element in the list. Example: l = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 6, 7, 8, 9, 9, 9, 9] 0 not ...
I'm calculating how many possibilities there are to fit \$n\$ identical bottles inside \$k\$ crates of various capacities. n = Number of bottles k = Number of crates K = List of the number of bottles each crate can fit Each crate may be filled with any number of bottles up to \$K_i\$, including being empty. This is a...
I am trying to create a fully async example of a client and server using SSL. I think these are the required assumptions: Connecting may require socket readability and writeability notifications. When the socket is readable, SSL_write may need to be called depending on the result of the last call to SSL_write. When th...
For a server-side Java application I want to have a random number generator. I'm using the ISAAC algorithm from Apache Commons Math 3 because it is both cryptographically strong and fast. I have written the following code to initialise the generator: public class ThreadLocalRandomGenerator { private static ThreadLo...
Design a program that finds all numbers from 1 to 1000 whose prime factors, when added together, sum up to a prime number (for example, 12 has prime factors of 2, 2, and 3, which sum to 7, which is prime). Implement the code for that algorithm. I'm pretty satisfied with what I did, but I want a review. Can I make it ...
I would appreciate any feedback concerning my analysis of the most efficient FizzBuzz solution programmed in Ruby. I submit that a Case-statement solution is more efficient than utilizing a ConditionalIf-statement in my recent blog-post within my conclusion provided thusly: Consequently, the predictability pattern is ...
The OpenGL tutorial that I was following only used a single model to demonstrate various points. I wanted to draw more than one model. After some research, I came to the conclusion that I needed to create a vertex array object, once for each model, and than I can use it to access buffers and attributes for each model. ...
I'm just getting started on the site CodeEval, and I submitted my first solution today. What I don't understand is why it's marking my (working) answer as only a "partial solution". The site doesn't seem to want to explain why my answer is only "partial", and I'm hoping someone here can explain why. The challenge I was...
I was reading up on implementing Graphs in Python and I came across this Essay at python.org about graphs, so I decided to implement it, but with weighted edges. I start with arcs and their cost using list of lists and then iterate through it building a dictionary (Adjacency list format) that represents the Undirected ...
Inspired by FizzBuzz by Brainfuck, I decided to write an interpreter for Brainfuck. It: Removes all non-command characters Optimizes commands (removing +- and <> pairs) Executes each command one-by-one Speed: FizzBuzz by Brainfuck: about 10 milliseconds Code: BFInterpreter.java import java.io.IOException; import ja...
I've been trying to learn the basics of Javascript, so this afternoon I put together a small JavaFX application that has a raw text area on the left, and an HTML rendering on the right: public class Fifty extends Application { private String filePath = null; private TextArea text; public void init() throws...
I have a MySQL database, with a table called articles. There is a column in articles for its id, name, date_created, etc. I want to create a page for each article, for example: example.com/article.php?id=1 example.com/article.php?id=2 ... My code works right now, but is there anything I should do differently? I'm wor...
Please review the code below where thread Odd prints all odd numbers from 1 to 9 and thread Even prints all even numbers from 2 to 8. I tested it and it works but can we improve it from design or performance perspective? To print odd public class Odd implements Runnable{ private Monitor sharedObject; public Odd(Monit...
My attempt at a simulation of one-handed Solitaire. Any comments welcome! // Basic implementation of one handed solitaire by Andrew Ewen. // // Not sure if working correctly as it wins roughly 1/90 games whereas wikipedia states it // is closer to 1/140. function Card (suit, rank) { this.suit = suit; this.ran...
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} data E a = E1 | E2 | E3 a data L data R f :: IO (Maybe (E L)) f = (undefined :: IO Bool) >>= \case False -> return (Just E1) True -> (undefined :: IO Bool) >>= \case False -> return (Just E2) True -> ...
I've written a program that counts the number of inversions using a Divide and Conquer algorithm, written in C++11. #include <iostream> #include <tuple> #include <vector> using IntVec = std::vector<int>; std::tuple<IntVec, long long> count_inv(IntVec xs); std::tuple<IntVec, long long> count_split_inv(IntVec xs, IntVe...
I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python. Latest code here. Assignment file and a few test files included in the folder. import sys import unittest from copy import deepcopy class PivotMaker: pass class PivotF...
I would like to know if there is anything that I missed following the GRASP patterns. The Main Controller class: using System; using System.Collections.Generic; using System.Diagnostics; namespace ConsoleApplication1 { public class SnakeGame { private bool GameIsPlaying...
I've written this a short time ago. Do you see anywhere I can improve my logic? This is my first python script. #!/usr/bin/python # -*- coding: utf-8 -*- import os from ftplib import FTP # ftplib comes with the py install class Ftp: def __init__(self, hostname, username, password, port=21): print '\nCo...
What would be the best way to refactor following method? public void AddOrUpdateDesign(DesignInformation designInformation, CommonTransformerProperties commonTransformerProperties, SecondaryWindings secondaryWindings, CapacitorVoltage...
Continuing from my last question I have now implemented a Double Linked list. All the code (with tests) is also available on GitHub. DobLinkedList.h #include <stdio.h> #include <stdbool.h> #ifndef DobLINKEDLIST_H #define DobLINKEDLIST_H #ifdef __cplusplus extern "C" { #endif typedef struct DobLinkedListNode { ...
I was in need of a function that could check a string against a certain pattern at compile-time. The pattern can contain any of the commonly known wildcards: ?, * and +. ? - match any character. * - match any sequence of characters, including the empty string. + - equal to ?* I'm not sure how to test my code for erro...
I am trying out for the first time knockoutjs and babeljs and have a question on how to do computed observables properly. Both fullName and fullNameComp properties are updated whenever firstName and lastName changes so not sure about pros/cons: <h2>employee</h2> <input type="text" data-bind="value: firstName, valueUpd...
I wrote implementation of LRU in java and want to know if it can be improved further both in space and time complexity. Input: Number of frames and reference string for pages. Output: Number of page faults. Also I am a little skeptical about its correctness because I got 6/10 in my practical lab. Kindly ignore OOP's a...
I have read this and I want to know how the solution that I came up with in my interview compares with the top solution. public static String reverseWords(String s) { if (s == null) return null; else if (s.equals("")) return ""; else { s = s.trim(); int index; for (index = 0; index <...
How can I make my code more pythonic ? I definitely think there is a way to make this code a lot more readable and clear + shorter... But I haven't found an effective way. Any techniques I can use to make it more concise and clear? #!/usr/bin/env python import requests import socket import random import re import time ...
I wrote this little helper to render a table, however, working with nested content_tag is messy. def semantic_table(table_headers) content_tag(:table, class: 'ui basic striped table') do (content_tag :thead do content_tag(:tr) do table_headers.each { |h| concat content_tag(:th, h) } ...
I made a simple hash table and I was wondering if there was any way to increase the efficiency of search times. My table class is called Dictionary, because C# has tainted me. The way I set this up is that Dictionary has an array of Buckets, a modified linked list whose Nodes store string keys as well as whatever other...
Similar to the previous post Brainfuck Interpreter: Slower than a Snail?, it runs BF in java. The only difference is that the converter will convert the BF code into a compilable and fairly readable Java code, and run it. Example: BF code: ++++++++++[>++++++++++<-]> Initialize 100 (number of times to perform FizzBuzz)...
This method has three parameters. If the extension is not null, for each item in list try to add extension to main text in a way that length of result doesn't exceed 20. I wrote this code, but I don't like its style. I like to use Linq and newer styles for doing this, in order to make it shorter. public string AddExten...
I'm new to programming (just about 2 months), and have been trying to learn as much as I can as quickly as I can. I made a little Hangman game as a practice project this weekend. It doesn't have visuals — the user is allowed 5 strikes. I used the enable1.txt list of words. Anyway, I was hoping to get some feedback on ...
A long time ago I created a script for moving up directories very quickly in the command line using the command up. You can find usage notes here. It's a very simple script with just 8 lines of source code, as follows: if [ -z "$1" ]; then cd .. else for i in `seq 1 $1`; do cd .. done fi I've ...
I wanted to keep my API request logic separate form the controller logic. I therefore make use of a separate model (EmailChecker) that creates an instance of this class via EmailChecker.new(params). Then I can check the new instance with valid?. When it returns false I grep the errors and return it. This example only c...
I've decided to make this module of a dialog, sort of like talking to NPCs in games, like this for example. I've creating the visuals of the window using the code from this post, works pretty well. Here's an example: I've created a Manager class to manage those pop-ups, and the obvious PopUpDialog class. Here's the Ma...