Skip to content

Instantly share code, notes, and snippets.

View billymoon's full-sized avatar

Billy Moon billymoon

View GitHub Profile
@billymoon
billymoon / php-auth-linux-account.php
Created October 30, 2011 10:34
function to authenticate users from within php against linux user accounts on the server
/* Need to add www-data to group shadow (and restart apache)
$ sudo adduser www-data shadow
$ sudo /etc/init.d/apache2 restart
Needs whois to be installed to run mkpasswd
$ sudo apt-get install whois
Assumes that sha-512 is used in shadow file
*/
function authenticate($user, $pass){
// run shell command to output shadow file, and extract line for $user
@billymoon
billymoon / cell0.js
Last active January 20, 2022 11:48
pseudo-random-data-generator-demo
import faker from "https://cdn.jsdelivr.net/npm/@faker-js/faker@6.0.0-alpha.3/dist/faker.min.js"; ///**import and configure faker**
faker.locales[faker.locale].name.male_prefix = ["Mr.", "Dr."];
faker.locales[faker.locale].name.female_prefix = ["Mrs.", "Miss.", "Dr."];
window.faker = faker;
@billymoon
billymoon / ToggleFormat.py
Last active December 12, 2017 10:09
Hack to have single command to swap semi and standard linting and formatting
import sublime
import sublime_plugin
STANDARD_SETTINGS_FILE = "StandardFormat.sublime-settings"
SEMI_STANDARD_SETTINGS_FILE = "SemiStandardFormat.sublime-settings"
def plugin_loaded():
global standardSettings
global semiStandardSettings
standardSettings = sublime.load_settings(STANDARD_SETTINGS_FILE)
@billymoon
billymoon / cell0.js
Last active October 5, 2017 22:27
untitled
import fiona from 'fiona'
import './lorem'
import './nino'
const seeded = fiona()
seeded.lorem()
seeded.sentence()

react-issuemd-poc

This Gist wa

dcr-generator

undefined

@billymoon
billymoon / functional-pollyfills.carbide.md
Last active October 2, 2016 22:13
functional-pollyfills

functional-pollyfills

@billymoon
billymoon / jquery-hook-issues
Created September 16, 2011 17:00
explaining problems with jQUery hooks
$.hook = function (fns){
fns = typeof fns === 'string' ? fns.split(' ') : $.makeArray(fns);
jQuery.each( fns, function (i, method) {
var old = $.fn[ method ];
if( old && !old.__hookold ){
$.fn[ method ] = function(){
this.triggerHandler('onbefore'+method);
this.triggerHandler('on'+method);
var ret = old.apply(this, arguments);
this.triggerHandler('onafter'+method);