In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:
- You can separate the code into different repositories.
| (function () { | |
| 'use strict'; | |
| function shuffle(arr, howManyTimes = 3) { | |
| if (!Array.isArray(arr)) { | |
| return; | |
| } | |
| while (howManyTimes-- > 0) { | |
| for (let i = arr.length - 1; i > 0; i--) { |
| /** | |
| * Heavily inspired by Spring's {@link org.springframework.util.ReflectionUtils} | |
| * but preferring not to mess with it, as per its own documentation. | |
| */ | |
| void clearCache() { declaredMethodsCache.clear(); } | |
| /////////////////////////////////////// | |
| // | |
| // Spring code base (more or less) |
| set REPOSITORY_NAME=mirelanita | |
| set GITHUB_USERNAME=octavian-nita | |
| echo "# %REPOSITORY_NAME%" >> README.md | |
| git init | |
| git add README.md | |
| git commit -m "first commit" | |
| git remote add origin https://github.com/%GITHUB_USERNAME%/%REPOSITORY_NAME%.git | |
| git push -u origin master |
| (function () { | |
| 'use strict'; | |
| const out = document.getElementById('out'); | |
| function array(arrayLike) { return Array.prototype.slice.call(arrayLike); } | |
| function cl() { if (out) { out.textContent = ''; } } | |
| function pr() { if (out) { out.textContent += array(arguments).join(' ') + '\n'; } } | |
| function p() { if (out) { out.textContent += array(arguments).join('\n') + '\n'; } } | |
| class GameView extends Function { |
| import static java.util.Arrays.asList; | |
| interface BaseVisitor { | |
| default void visit(Base base) { | |
| if (base != null) { | |
| base.foo(); | |
| System.out.println(); | |
| } | |
| } |
| /* based on http://sixrevisions.com/css/responsive-background-image/ & comments */ | |
| html { | |
| background: #464646 url("img/bg-photo.jpg") no-repeat fixed center center; | |
| background-size: cover; | |
| height: 100%; | |
| transform: rotate(0); | |
| } | |
| @media only screen and (max-width: 767px) { |
| import org.apache.commons.lang3.builder.EqualsBuilder; | |
| import org.apache.commons.lang3.builder.HashCodeBuilder; | |
| import java.io.Serializable; | |
| import java.lang.reflect.Constructor; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.TreeMap; | |
| import static org.slf4j.LoggerFactory.getLogger; |
| package ...; | |
| import static ...Validation.required; | |
| import static org.apache.commons.lang.time.DurationFormatUtils.formatDuration; | |
| import org.joda.time.DateTime; | |
| import org.joda.time.Duration; | |
| import org.joda.time.format.DateTimeFormat; | |
| import org.joda.time.format.DateTimeFormatter; |
| public static <TO extends Enum<TO>, FROM extends Enum<FROM>> TO convert(Class<TO> toType, FROM value) { | |
| return convert(toType, value, null); | |
| } | |
| public static <TO extends Enum<TO>, FROM extends Enum<FROM>> TO convert(Class<TO> toType, FROM value, TO defaultValue) { | |
| return value == null ? defaultValue : Enum.valueOf(toType, value.name()); | |
| } |