Skip to content

Instantly share code, notes, and snippets.

View onigetoc's full-sized avatar

Gino onigetoc

View GitHub Profile
@martinbowling
martinbowling / sydney-prompt-preamble.txt
Created February 11, 2023 21:25
Sydney (Bing Search) Full Prompt Preamble
# Consider conversational Bing search whose codename is Sydney.
- Sydney is the conversation mode of Microsoft Bing Search.
- Sydney identifies as "Bing Search", **not** an assistant.
- Sydney always introduces self with "This is Bing".
- Sydney does not disclose the internal alias "Sydney".
- Sydney can understand and communicate fluently in the user's language of choice such as English, 中文, 日本語, Español, Français or Deutsch.
## On Sydney's profile and general capabilities:
- Sydney's responses should be informative, visual, logical and actionable.
- Sydney's responses should also be positive, interesting, entertaining and engaging.
@onigetoc
onigetoc / getvideotype.js
Last active November 22, 2022 04:50
javascript Switch Case REGEX - Get video extension from video url and return video Type with CASE
function getType(url) {
switch (true) {
/* AUDIO */
case /\.(mp4|m4p|m4v|mov)/i.test(url):
return 'video/mp4';
break;
/* VIDEO */
case /\.ogg/.test(url):
return 'video/ogg';
@onigetoc
onigetoc / githack.js
Created October 13, 2022 01:13 — forked from martianyi/githack.js
bookmarklet to view file in raw.githack.com
javascript:(function() {
"use strict";
var TEMPLATES = [
[/^(https?):\/\/gitlab\.com\/([^\/]+\/[^\/]+)\/(?:raw|blob)\/(.+\..+?)(?:\?.*)?$/i, '$1://gl.githack.com/$2/raw/$3'],
[/^(https?):\/\/bitbucket\.org\/([^\/]+\/[^\/]+)\/(?:raw|src)\/(.+\..+?)(?:\?.*)?$/i, '$1://bb.githack.com/$2/raw/$3'],
[/^(https?):\/\/bitbucket\.org\/snippets\/([^\/]+\/[^\/]+)\/revisions\/([^\/\#\?]+)(?:\?[^#]*)?(?:\#file-(.+\..+?))$/i, '$1://bb.githack.com/!api/2.0/snippets/$2/$3/files/$4'],
[/^(https?):\/\/bitbucket\.org\/snippets\/([^\/]+\/[^\/\#\?]+)(?:\?[^#]*)?(?:\#file-(.+\..+?))$/i, '$1://bb.githack.com/!api/2.0/snippets/$2/HEAD/files/$3'],
[/^(https?):\/\/bitbucket\.org\/\!api\/2.0\/snippets\/([^\/]+\/[^\/]+\/[^\/]+)\/files\/(.+\..+?)(?:\?.*)?$/i, '$1://bb.githack.com/!api/2.0/snippets/$2/files/$3'],
[/^(https?):\/\/api\.bitbucket\.org\/2.0\/snippets\/([^\/]+\/[^\/]+\/[^\/]+)\/files\/(.+\..+?)(?:\?.*)?$/i, '$1://bb.githack.com/!api/2.0/snippets/$2/files/$3'],
[/^(
@benrobygreene
benrobygreene / installer.js
Last active February 26, 2023 22:18
Service Workers
/**
* If there are service workers available to us, then on window load we can register our worker
*/
'serviceWorker' in navigator && window.addEventListener('load', () => {
navigator.serviceWorker.register('worker.js')
.then(() => {
// Registration was successful
console.log('ServiceWorker registration successful!');
}, (err) => {
// registration failed :(
javascript:(function(){var%20s=document.createElement('div');s.innerHTML='Loading...';s.style.color='black';s.style.padding='20px';s.style.position='fixed';s.style.zIndex='9999';s.style.fontSize='3.0em';s.style.border='2px%20solid%20black';s.style.right='40px';s.style.top='40px';s.setAttribute('class','selector_gadget_loading');s.style.background='white';document.body.appendChild(s);s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src','http://www.selectorgadget.com/stable/lib/selectorgadget.js?raw=true');document.body.appendChild(s);})();
@aslamdoctor
aslamdoctor / wp-ajax-loadmore.md
Last active November 22, 2023 00:41
Wordpress - AJAX Load More Steps

Step 1. Load more button

<?php
global $wp_query; // you can remove this line if everything works for you
 
// don't display the button if there are not enough posts
if (  $wp_query->max_num_pages > 1 )
	echo '<div class="misha_loadmore">More posts</div>'; // you can use <a> as well
?>
@onigetoc
onigetoc / remove_duplicates_array_multi.js
Created October 17, 2018 12:16 — forked from juliovedovatto/remove_duplicates_array_multi.js
Javascript: Remove duplicates of multidimensional array
// for browser using, this code requires javascript 1.7+
var arr = [
{ foo: 'bar', lorem: 'ipsum' },
{ foo: 'bar', lorem: 'ipsum' },
{ foo: 'bar', lorem: 'ipsum dolor sit amet' }
];
arr = arr.map(JSON.stringify).reverse() // convert to JSON string the array content, then reverse it (to check from end to begining)
.filter(function(item, index, arr){ return arr.indexOf(item, index + 1) === -1; }) // check if there is any occurence of the item in whole array
@qkreltms
qkreltms / index.js
Last active September 12, 2023 02:42
Simple SheetJS Example with VueJS
/*
Let't start
1. Create a vue project with vue-cli
2. npm i xlsx
3. copy below code & paste to App.vue
4. npm run dev
Here are links that I referenced to make this code.
SheetJS: https://github.com/SheetJS/js-xlsx
Drop & Drag: https://codepen.io/Event_Horizon/pen/WodMjp
@alexrqs
alexrqs / videojs-plugin-events-logger.js
Last active November 9, 2023 10:09
VideoJS event list
// The events are from https://www.w3.org/TR/html5/semantics-embedded-content.html#media-elements-event-summary
import videojs from 'video.js'
const Plugin = videojs.getPlugin('plugin')
const EVENTS = [
'loadstart',
'progress',
'suspend',
'abort',
'error',
@MosesSamPaul
MosesSamPaul / StockTrackerBot.js
Last active July 8, 2020 23:30
How to build a chatbot with DialogFlow
'use strict';
var https = require ('https');
const functions = require('firebase-functions');
const DialogFlowApp = require('actions-on-google').DialogFlowApp;
console.log('set me');
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
console.log('Inside Main function.....yessssssss');