Skip to content

Instantly share code, notes, and snippets.

View NateJLewis's full-sized avatar
🎯
Focusing

Nate Lewis NateJLewis

🎯
Focusing
View GitHub Profile
@JayZar21
JayZar21 / get_mac_address.py
Last active April 20, 2020 13:39 — forked from zhenyi2697/get_mac_address.py
Python: get mac address of a interface
# Python 2:
import socket
import fcntl
import struct
def getHwAddr(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15]))
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1]
@davidbradway
davidbradway / setup.md
Last active May 19, 2020 22:00
Set Up Docker On Raspberry Pi Raspbian Stretch Lite
@homerjam
homerjam / mdChipDraggable.js
Last active September 14, 2021 11:06
Angular Material draggable chips directive
angular.module('mdChipDraggable', [])
.directive('mdChipDraggable', function () {
return {
restrict: 'A',
scope: {},
bindToController: true,
controllerAs: 'vm',
controller: ['$document', '$scope', '$element', '$timeout',
function ($document, $scope, $element, $timeout) {
var vm = this;
<?php
/**
* Abstract class for making API routes
*
* @package @todo
* @author Josh Pollock <Josh@JoshPress.net>
* @license GPL-2.0+
* @link
* @copyright 2015 Josh Pollock
*/
@dmitry-korolev
dmitry-korolev / get_excerpt_by_id.php
Created September 22, 2015 17:19
Get excerpt by id in Wordpress.
<?php
if (!function_exists(get_excerpt_by_id)) {
/**
* Returns excerpt by ID. WP_Post->post_excerpt if it presents, wp_trim_words on other case.
* @param mixed $post WP_Post object or post ID. Accepts WP_Post object or post ID (integer or string);
* @return string Excerpt
*/
function get_excerpt_by_id($post) {
$return_excerpt = function($post) {
if ($post->post_excerpt == '')
@neilgee
neilgee / _s_custom.header.php
Last active May 13, 2016 10:10
Custom Headers
<?php //<~ don't add me
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="">
</a>
<?php endif; // End header image check. ?>
@milanaryal
milanaryal / schema-org-structured-data-markup-using-microdata.html
Last active November 4, 2023 13:45
An example of how to mark up a HTML5 webpage using the schema.org schemas and microdata.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Site Title</title>
<link rel="stylesheet" href="/assets/css/style.min.css">
@tommcfarlin
tommcfarlin / ajax-reg.js
Last active August 26, 2017 14:08 — forked from csknk/ajax-reg.js
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@elliotbonneville
elliotbonneville / topkeywords.js
Last active August 23, 2022 10:26
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@neilgee
neilgee / scrollreveal.php
Last active August 29, 2015 14:08
ScrollReveal.js in Genesis
<?php
//do not add in opening php tag
/**
* Add in ScrollReveal.js in a Genesis Theme
*
* @package Add in ScrollReveal.js in a Genesis Theme
* @author Neil Gee
* @link http://wpbeaches.com/using-scrollreveal-js-wordpress-genesis-theme/