Skip to content

Instantly share code, notes, and snippets.

View isogram's full-sized avatar
🙊

Muhammad Shidiq isogram

🙊
View GitHub Profile
@isogram
isogram / regex_hashtag.md
Last active August 29, 2015 14:28
Regex Hashtag
  1. Catch hashtag exclude starting and ending with underscore
    (?:\s|^)(?:#(?!(?:\d+|\w+?_|_\w+?)(?:\s|$)))(\w+)(?=\s|$)
  2. Catch hashtag include starting and ending with underscore
    (?:\s|^)(?:#(?!\d+(?:\s|$)))(\w+)(?=\s|$)
  3. Catch repeating words (only catch 1 if duplicate) (?!.*\b\1\b)

You can test regex at https://regex101.com/

@isogram
isogram / get_followers_following_list.sql
Created August 18, 2015 05:28
Query to get users by keyword order by match
SELECT
t1.user_id,
t1.user_uuid,
t1.first_name,
t1.last_name,
t1.user_name,
IF (t2.follow_status, 1, 0) AS is_following,
IF (t3.follow_status, 1, 0) AS is_followers
FROM
t_user t1
# SYNTAX:
var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches)
var pattern = /pattern/attributes; # same as above
# BRACKETS:
[...]: Any one character between the brackets.
[^...]: Any one character not between the brackets.
@isogram
isogram / cronjob
Created June 25, 2015 05:05
Cronjob Manual
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
5 8 * * Sat /usr/bin/find
@isogram
isogram / nginx.conf
Last active August 29, 2015 14:20 — forked from neara/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@isogram
isogram / .htaccess
Last active August 29, 2015 14:20 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/