Skip to content

Instantly share code, notes, and snippets.

@BeFiveINFO
BeFiveINFO / backend.min.js
Created November 28, 2017 23:30
VC backend.min.js
function vc_toTitleCase(str) {
return str.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
})
}
function vc_convert_column_size(width) {
var numbers = width ? width.split("/") : [1, 1],
range = _.range(1, 13),
num = !_.isUndefined(numbers[0]) && 0 <= _.indexOf(range, parseInt(numbers[0], 10)) && parseInt(numbers[0], 10),
# any external incoming request to images hosted are redirected to other server holding dummy of the original content
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?thememountain\.com/ [NC]
RewriteRule (.*)\.(jpe?g|gif|ogv|webm|bmp|png|mp4|svg|css)$ http://placeholders.thememountain.com/wordpress/$1.$2 [NC,R,L]
@BeFiveINFO
BeFiveINFO / batch.sh
Created March 28, 2017 23:51
File list and template replacement example
#!/bin/bash
sectionTemplate="$(cat ../section_template.php)"
i=0
while read line
do
array[ $i ]="$line"
(( i++ ))
done < <(ls)
@BeFiveINFO
BeFiveINFO / .htaccess
Last active March 24, 2017 22:05
WordPress .htaccess Example for Hotlinking Protection
# Hotlink Protection
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourdomain\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|ogv|webm|bmp|png|mp4|svg|css|)$ http://your.domain.com/protected-image-banner.jpg [NC,R,L]
@BeFiveINFO
BeFiveINFO / .htaccess
Last active March 24, 2017 21:44
WordPress .htaccess Example for Diverting Access to Image for XML Import (Demo Contents) and Bot Prevention
# For Diverting Access to Image for XML Import (Demo Contents)
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^.*(WordPress).*$
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-content/(.*)\.(jpe?g|gif|ogv|webm|bmp|png|mp4|svg|)$ http://your.domain.com/wp/$1$2.$3 [NC,R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
@BeFiveINFO
BeFiveINFO / gist:c64b26d1c9eaac644dd6be0d91fa3033
Created January 31, 2017 19:48
Installing Wordpress with cli
Install MAMP first.
Install WP CLI
Make directory for the wp installation (in my case, ~/Sites/wordpress)
Install Wordpress with WP-CLI
- wp core download --path=~/Sites/wordpress
CD to the root of WP installation (cd ~/Sites/wordpress) then Generate Config by using wpcli
@BeFiveINFO
BeFiveINFO / Default (OSX).sublime-keymap
Last active October 11, 2018 20:38
Sublime Text 3 Clean Install Set Up Memo
[
{
"keys": ["super+shift+r"],
"command": "reindent",
"args": {"single_line": true}
},
{
"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{ "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
@BeFiveINFO
BeFiveINFO / gist:58663a287abd1e1ae228f7de31ef0761
Created December 20, 2016 21:39
Year to 恵方 (Éhou) conversion chart
|Last one digit of the year|恵方 (Éhou)|干支 (Éto)|Direction|
|4, 9|東北東微東|甲 (Kinoé, Older Brother of Armor)|75 degrees|
|5, 0|西南西微西|庚 (Kanoé, Older Brother of Gold)|255 degrees|
|6, 1|南南東微南|丙 (Hinoé, Older Brother of Fire)|165 degrees|
|7, 2|北北西微北|壬 (Mizunoé, Older Brother of Water)|345 degrees|
|8, 3|南南東微南|丙 (Hinoé, Older Brother of Fire)|165 degrees|
@BeFiveINFO
BeFiveINFO / gist:a7d7da6deecd1ecc5b4935505fcb9ebd
Created December 12, 2016 20:07
源平討魔伝 GENPEITD PSG(WSG) waveform data
0123456789ABCDEF0123456789ABCDEF
N0 9ABCDDEEEDDCBA975432110001123457
N1 00FFFFFFFFF000000FF00FF00FF00770
N2 789876579BDA74058BFC963579BA9878
N3 878768A748C728E707E827C847A86787
N4 1356BDFDCEDB76554442567874534210
N5 0234578ABCE689A746789B3578AACDFC
N6 03478B368ACE78B85892468AD579BCFC
N7 7ACCEEBEC97755799797752002200223
N8 02468ACEEDCBA9877654321002468ACE
0123456789ABCDEF0123456789ABCDEF
N1 0123456789ABCDEFEDCBA98765422100
N2 89BCDEEFFEEDCB986543211001123456
N3 7ACCEEBEC97755799797752002200223
N4 1359BDFDECD876554442567874534210
N5 FEEDDCCBBAA998877665544332211007
N6 00FFFFFFFFF000000FF00FF00FF00770
N7 EEE770777077EEE700077E777E770007
N8 78594C0F0E10496778594C0F0E104967