Skip to content

Instantly share code, notes, and snippets.

View tofuninjah's full-sized avatar
🖤

Chung Kang tofuninjah

🖤
View GitHub Profile
@tofuninjah
tofuninjah / SpringPreprocessString
Created December 14, 2018 17:10
Spring Whitespace Trim
### Preprocess all Web Requests
@InitBinder
public void initBinder(WebDataBinder) dataBinder) {
StringTrimmerEditor stringTrimmerEditor = new StringTrimmerEditor(true);
dataBinder.registerCustomEditor(String.class, stringTrimmerEditor);
}
// StringTrimmerEditor(true) -> Removes whitespace, TRUE means empty returns null
// Use dataBinder to register the custom editor -> for every String class, apply the stringTrimmerEditor
@tofuninjah
tofuninjah / getTruncatedZipCode
Created December 11, 2018 19:47
Method to truncate the Zipde code and remove plus 4 digits at the end
import java.lang.Math; // headers MUST be above the first class
import java.util.*;
// one class needs to have a main() method
public class HelloWorld {
public static String getTruncatedZipCode(String inputString) {
String retVal = "";
@tofuninjah
tofuninjah / sample-spring-restful-controller
Created November 13, 2018 18:25
Sample Spring RESTful controller
package com.abc.vendor.controllers;
import com.abc.vendor.entities.Vendor;
import com.abc.vendor.repos.VendorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@tofuninjah
tofuninjah / vs-code-extensions
Last active November 20, 2018 02:51
Visual Studio Code - Extensions
### User Settings:
{
"java.errors.incompleteClasspath.severity": "ignore",
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"emmet.syntaxProfiles": {
"javascript": "jsx",
"javascript": "html"
},
@tofuninjah
tofuninjah / git aliases
Last active January 28, 2019 17:44
Git aliases
git config --global alias.lola 'log --graph --oneline --decorate --all'
git config --global alias.append 'commit --amend --no-edit'
git config --global alias.unstage 'reset HEAD --'
git config --global alias.logo 'log --oneline --graph'
###### git commit --amend #####
# Amends the previous commit message
# Useful to add additional changes to previous commit
# This command takes your staging area and uses it for the commit. If you’ve made no changes since
@tofuninjah
tofuninjah / amazon sns
Created April 10, 2018 12:07
Amazon SNS
# https://curl.haxx.se/docs/caextract.html
/** Begin the text messaging **/
$params = array(
'credentials' => array(
'key' => 'key',
'secret' => 'secret',
),
'region' => 'us-east-1', // < your aws from SNS Topic region
'version' => 'latest',
@tofuninjah
tofuninjah / gist:dfae99e12105b70835831bcd959bd374
Created March 13, 2018 19:53
delete older vagrant boxes
vagrant box remove laravel/homestead --box-version=0.1.7
@tofuninjah
tofuninjah / gist:2f9f67080cbbbbfcf0b940d8c6d04abe
Created December 29, 2017 06:37
Common Text Ad Mistakes
Common Text Ad Mistakes
Once you save an ad, Google will evaluate the ad for approval and you will be notified when the ad is approved and ready to go. If you’ve done something Google doesn’t like in your ad, it will disapprove your ad and you have to edit it.
We will help you get your text ads approved by going over the most common mistakes. The majority of mistakes fall into two categories: mistakes with your ad’s copy, and mistakes with your ad’s URL.
Let’s start with your ad’s copy:
Avoid excessive or unconventional capitalization
You are free to capitalize words, but stay away from excessive capitalization. For example, Google doesn’t allow ALL CAPS or capitalization within a word (such as SpEcIaL OfFeR).
Only use appropriate punctuation and symbols
@tofuninjah
tofuninjah / gist:ec52429693aa47c763c9e8d21baf701b
Created December 29, 2017 06:37
How to Create Successful Text Ads
How to write successful text ads
Now that you know what Google Search Ads look like, let’s go through some of the best practices of writing specific, relevant, attractive, and actionable text ads.
Highlight what makes you unique
When coming up with your headline, think of what makes you stand out from the competition. Your ad will likely be displayed among a few other ads that advertise products similar to yours. Go back to your Value Proposition you created earlier and make sure your potential customers know about what makes your product or service unique.
Include special offers or terms
If you offer free shipping, a money-guarantee, a sale or special offers (e.g. Buy one, get one free or 25% off everything), make sure to include that in your ad description. Calling attention to specific prices or promotions can help influence someone's decision to click on your ad.
Include numbers
@tofuninjah
tofuninjah / destructuring
Last active December 2, 2017 08:36
destructuring
// const person = {
// name: 'Andrew',
// age: 27,
// location: {
// city: 'Philadelphia',
// temp: 88
// }
// };
// const { name: firstName = 'Anonymous', age } = person;