Skip to content

Instantly share code, notes, and snippets.

View ashpriom's full-sized avatar
🎯
Focusing

Syed Priom ashpriom

🎯
Focusing
View GitHub Profile
add_action( 'admin_init', 'theme_options_init' );
add_action( 'admin_menu', 'theme_options_add_page' );
function theme_options_init(){
register_setting( 'sample_options', 'sample_theme_options');
}
function theme_options_add_page() {
add_theme_page( __( 'Theme Options', 'sampletheme' ), __( 'Theme Options', 'sampletheme' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );
}
function theme_options_do_page() {
global $select_options;
@ashpriom
ashpriom / toggleVisibility.js
Created May 19, 2016 17:48
Toggle Visibility of DIVs
<script type="text/javascript">
function toggleDiv(divId){
$("#"+divId).toggle();
if($("#yestext3").is(':visible')){
if($("#yestext2").is(':visible')){
if($("#yestext1").is(':visible')){
$("#congrats").toggle("1000");
}
}
}
@ashpriom
ashpriom / AhoCorasick.cpp
Last active February 11, 2021 12:26 — forked from mejibyte/gist:1233426
An implementation of Aho-Corasick algorithm in C++
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>

import java.util.regex.Pattern;

public class CountSubstring { public static int countSubstring(String subStr, String str){ // the result of split() will contain one more element than the delimiter // the “-1” second argument makes it not discard trailing empty strings return str.split(Pattern.quote(subStr), -1).length - 1; }

public static void main(String[] args){