Skip to content

Instantly share code, notes, and snippets.

View furryronin's full-sized avatar

furryronin

View GitHub Profile
@furryronin
furryronin / gist:9597a35c3b55ae9b75de2890e583d9bd
Created May 9, 2023 09:35
most_used: Find most used word in a sentence
var str = "spam, spam and eggs, spam and chips, Ham Spam and Eggs, Eggs Eggs Spam and Spam";
function unique(a) {
var tmp = {};
for (var i = 0; i < a.length; i++)
tmp[a[i]] = true;
var r = [];
for (var k in tmp)
r.push(k);
return r;
@furryronin
furryronin / blade-template.php
Created March 24, 2018 13:21 — forked from searleb/blade-template.php
Slick Slider with custom controls and slide indicator
// blade template - just html really
@section('journal-carousel')
<div class="container article-carousel">
<div class="row">
<div class="col-sm-12">
<div class="article-carousel__slider">
@for ($i = 0; $i < 3; $i++)
<figure><img src="{{Theme::url('images/blonde'.$i.'.jpg')}}" alt="" class="img-responsive" /></figure>
@endfor
@for ($i = 0; $i < 3; $i++)
@furryronin
furryronin / custom-select.html
Created November 18, 2017 21:02
custom select box
<style>
.select-style {
border: 1px solid #ccc;
width: 120px;
border-radius: 3px;
overflow: hidden;
background: #fafafa url("img/icon-select.png") no-repeat 90% 50%;
}
.select-style select {
@furryronin
furryronin / simple-pdo.php
Created November 17, 2017 14:20
Simple pdo php with error catch, Small output example included
<?php
try {
$pdo = new PDO('mysql:host=localhost;dbname=ijdb;
charset=utf8', 'ijdbuser', 'mypassword');
$pdo->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
$sql = '';
$result = $pdo->query($sql);
while ($row = $result->fetch()) {
@furryronin
furryronin / alt-tag-highlight.css
Created November 17, 2017 11:37
Highlight any images without alt tags
/* you forgot the 'alt' attribute */
img[alt=""],
img:not([alt]) {
border: 5px dashed #c00
}
@furryronin
furryronin / array-refactor.js
Created August 3, 2017 11:48
Javascript refactor of array for unique values
/*
@author: Gareth Hogan - @furryronin
#@copyright: Copyright free
#@version: 2.0.0
#@info: JS function refactor array for unique values
#@dependencies: none
#@license: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
#@info: Author accepts no responsibility for the use of this code
#@additional credits: GNU Terry Prachett
*/
@furryronin
furryronin / smooth-on-page-anchor-scroll.js
Created August 3, 2017 11:36
Jquery / Bootstrap smooth anchor scroll function
/*
#@author: Gareth Hogan - @furryronin
#@copyright: Copyright free
#@version: 1.2.1
#@info: Smooth anchor scroll, can't remember where it came from originally but has been changed
#@dependencies: Jquery 1.11+.*
#@license: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
#@info: Author accepts no responsibility for the use of this code
#@additional credits: GNU Terry Prachett
@furryronin
furryronin / var-from-url.js
Last active August 3, 2017 11:29
Javascript / Jquery function to grab var from url
/*
@author: Gareth Hogan - @furryronin
#@copyright: Copyright free
#@version: 2.0 - added decodeURI
#@info: JS Snippit to grab variable from a url with js
#@dependencies: none
#@license: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
#@info: Author accepts no responsibility for the use of this code
#@additional credits: GNU Terry Prachett
*/
@furryronin
furryronin / googleforms2slack.gs
Created August 3, 2017 11:14 — forked from andychase/googleforms2slack.gs
Google Forms Slack Notification
// Google Forms Slack Notification
// Andy Chase <github.com/andychase>
// License: CC0 1.0 Universal <creativecommons.org/publicdomain/zero/1.0>
// Install 1: This code goes in ( tools > script editor... ) of your google docs form
// Install 2: ( resources > current project triggers ) ( [onSubmit], [from Form], [On form submit] )
// Setup 1: Put your slack api url below
var POST_URL = "https://hooks.slack.com/services/";
function onSubmit(e) {
@furryronin
furryronin / slack-form-post.php
Created July 29, 2017 14:30
Post to slack channel webhook from form
<?php
#@author: Gareth Hogan - @furryronin
#@copyright: Copyright free
#@version: Applied Styles Rev.2.0, Site Rev.3.1
#@info: Post to Slack chanel webhook from form
#@dependencies: PHP5+ / CURL
#@license: http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
#@info: Author accepts no responsibility for the use of this code
#@additional credits: GNU Terry Prachett