- You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use
rails new
first to generate all of the boilerplate files necessary. - Create an app in the current directory with
rails new .
- Use Tailwind CSS for styling. Use
--css tailwind
as an option on therails new
call to do this automatically. - Use Ruby 3.2+ and Rails 8.0+ practices.
- Use the default Minitest approach for testing, do not use RSpec.
- Default to using SQLite in development.
rails new
will do this automatically but take care if you write any custom SQL that it is SQLite compatible. - An app can be built with a devcontainer such as
rails new myapp --devcontainer
but only do this if requested directly. - Rails apps have a lot of directories to consider, such as app, config, db, etc.
- Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
- Guard against incapable browsers accessing controllers with `allo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
lsof -nP -iTCP -sTCP:LISTEN | grep $1 |
git remote add all REMOTE-URL-1
git remote set-url --add --push all REMOTE-URL-1
git remote set-url --add --push all REMOTE-URL-2
git push all BRANCH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-cli eval "return redis.call('hset', KEYS[1], KEYS[2], struct.pack('dLc0', 0.0, string.len(ARGV[1]), ARGV[1]))" 2 "test-map" "key1" '{"value":"hello world"}' | |
redis-cli eval "local value = redis.call('hget', KEYS[1], KEYS[2]); local t, val = struct.unpack('dLc0', value); return val;" 2 "test-map" "key1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.addFilter(object: AbstractPreAuthenticatedProcessingFilter() { | |
override fun getPreAuthenticatedPrincipal(req: HttpServletRequest) = req.getHeader("X-API-KEY") ?: "" | |
override fun getPreAuthenticatedCredentials(req: HttpServletRequest) = "" | |
}.apply { | |
setAuthenticationManager { | |
it.isAuthenticated = it.principal == "{your-api-key}" | |
it | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -rubygems | |
# | |
# Point appcrush at an .ipa file from the iTunes AppStore and it | |
# - expands the zip file | |
# - finds all the images | |
# - runs pngcrush with the revert-iphone-optimizations option on each image | |
# | |
# Requirements Xcode with iOS SDK 3.2 or higher | |
# | |
# Usage: appcrush '/Users/boctor/Music/iTunes/Mobile Applications/iBooks.ipa' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>tv.anypoint</groupId> | |
<artifactId>spark-spring-boot</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.target>1.8</maven.compiler.target> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE") | |
} | |
apply plugin: 'spring-boot' | |
springBoot { | |
customConfiguration = 'runtime' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check java version | |
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') | |
if [ "$JAVA_VER" -lt 18 ] | |
then | |
# Download jdk 8 | |
echo "Downloading and installing jdk 8" | |
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.rpm" | |
# Silent install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ./ -name "*.sql" -exec file -i {} \; | grep "charset=iso-8859-1" | cut -d':' -f1 | while read a; do iconv -c -f euc-kr -t utf-8 $a > "$a-utf8.sql"; cat "$a-utf8.sql" > "$a"; rm "$a-utf8.sql"; done |
NewerOlder