Skip to content

Instantly share code, notes, and snippets.

@andrei-m
andrei-m / levenshtein.js
Last active January 12, 2024 23:00
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@clarle
clarle / app.js
Created July 26, 2012 07:35
Short tutorial on how to use Express and node-mysql
// Module dependencies
var express = require('express'),
mysql = require('mysql');
// Application initialization
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@hullen
hullen / get_gallery_attachments.php
Last active March 9, 2020 20:57
Extract images ids from gallery shortcode into post_content of the wordpress posts or custom post types.
@rxaviers
rxaviers / gist:7360908
Last active June 15, 2024 20:43
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@ValentinH
ValentinH / queryTwitter.php
Created January 5, 2014 10:35
How to query Twitter search API in PHP. This example shows how to query a hashtag and get the top 100 more recent results. * require CURL.
function queryTwitter($search)
{
$url = "https://api.twitter.com/1.1/search/tweets.json";
if($search != "")
$search = "#".$search;
$query = array( 'count' => 100, 'q' => urlencode($search), "result_type" => "recent");
$oauth_access_token = "ABCD";
$oauth_access_token_secret = "1234";
$consumer_key = "abcd";
$consumer_secret = "5678";
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup
@jayllellis
jayllellis / active-slide.js
Last active February 8, 2020 13:04
Add a class to current slide in bxSlider
$('.top-slider').bxSlider({
onSliderLoad: function(currentIndex) {
$('.top-slider').children().eq(currentIndex).addClass('active-slide');
},
onSlideAfter: function($slideElement){
$('.top-slider').children().removeClass('active-slide');
$slideElement.addClass('active-slide');
}
});
@jayllellis
jayllellis / placeholder.css
Last active September 20, 2018 19:08
Change placeholder colour
input[type="text"]::-webkit-input-placeholder{ /* Chrome/Opera/Safari */
color: pink;
}
input[type="text"]::-moz-placeholder { /* Firefox 19+ */
color: pink;
}
input[type="text"]:-ms-input-placeholder { /* IE 10+ */
color: pink;
}
input[type="text"]:-moz-placeholder { /* Firefox 18- */
@jayllellis
jayllellis / page-ids.php
Last active February 4, 2019 16:34
Get page IDs for certain kinds of pages
<?php
// Special pages -----------------
$frontpage_id = get_option( 'page_on_front' );
$blog_id = get_option( 'page_for_posts' );
// Page templates -----------------
$about_templates = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'page-about.php'
@jentanbernardus
jentanbernardus / vhost.md
Last active January 19, 2024 08:40
Setting Up Virtual Hosts in MAMP on Windows

1. Edit MAMP Apache configuration to include Virtual Hosts configuration

In File Explorer, go to C:\MAMP\conf\apache and open httpd.conf with your text editor.

Find this line:

# Virtual hosts
# Include conf/extra/httpd-vhosts.conf