Skip to content

Instantly share code, notes, and snippets.

View arcticmouse's full-sized avatar

arcticmouse

View GitHub Profile
let dogs = [
{name:'Osito', age: 15},
{name:'Nana', age: 1},
{name:'Bella', age: 8},
]
function filterDogs(minimumAge){
let dogs2 = []
for(let i = 0; i<dogs.length; i++){
if(minimumAge <= dogs[i].age)
@arcticmouse
arcticmouse / gist:7d03c70201699b4265f7782809a6342f
Created January 28, 2020 05:02
techtonica create counter class
function createCounter(startingValue){
var counter = startingValue
var newObject = {
getValue: function() { return counter },
increment: function() { return counter++ }
}
return newObject
}
@arcticmouse
arcticmouse / gist:eb9d07903caf30ff7f5e205058d59677
Created January 18, 2020 23:25
techtonica challenge 1/16
numbers = [1, 2, 3, 4, 5]
function onlyEvens(n) {
if(n % 2 == 0) {
return true
}
else {
return false
}
}
function var_error_log( $object=null ){
ob_start(); // start buffer capture
var_dump( $object ); // dump the values
$contents = ob_get_contents(); // put the buffer into a variable
ob_end_clean(); // end capture
error_log( $contents ); // log contents of the result of var_dump( $object )
}
error_log( print_r($multidimensionalarray, TRUE) );
@arcticmouse
arcticmouse / README-Template.md
Created April 6, 2018 23:56 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@arcticmouse
arcticmouse / gist:8c97d5b14759488ae0deb6c36a084019
Created February 16, 2018 20:28
WP add user through database
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('pass123'), 'firstname lastname', 'email@example.com', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');
grep -rnw '/path/to/somewhere/' -e 'pattern'
@arcticmouse
arcticmouse / gist:0f30f88cf5f32a4e9755c24c7ef3ec8a
Created November 22, 2017 17:29
regex(php) match url (ftp/http/https)
(((ftp|https?):\/\/)(www\.)?|www\.)([\da-z-_\.]+)([a-z\.]{2,7})([\/\w\.-_\?\&]*)*\/?
@arcticmouse
arcticmouse / gist:44227a8a53197a5e89b44c55c5021d47
Last active September 11, 2017 23:12
Recursively search directory in terminal for duplicate files
find . -type f | sed 's/^.*\/\([^/]*\)$/\1/' | sort | uniq -c | grep -v '^ 1'
IFS=$'\n'; for f in `find . -type f | sed 's/^.*\/\([^/]*\)$/\1/' | sort | uniq -c | grep -v '^ 1'`; do echo $f; t=`echo "$f" | awk '{print $2}'`; find . -name $t; echo $'\n'; done
IFS=$'\n'
dupes=`find . -type f |
sed 's/^.*\/\([^/]*\)$/\1/' |
sort |