This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($('ul.crossfade').length) { | |
$('ul.crossfade').each(function(){ | |
var ul = $(this); | |
if ($('li', ul).length > 1) { | |
$('li:gt(0)', ul).hide(); | |
var fadeSpeed = (ul.attr('data-fadespeed') !== undefined ? ul.attr('data-fadespeed') : 1000); | |
var nextSpeed = (ul.attr('data-nextspeed') !== undefined ? ul.attr('data-nextspeed') : 5000); | |
setInterval(function(){ | |
$('li:first', ul) | |
.fadeOut(fadeSpeed).next('li') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Same Height, jQuery plug-in. | |
* | |
* This plug-in allows you to automatically have all of the elements marked | |
* with a particular class to be the same height, either by smallest or | |
* largest. | |
* | |
* By default, 'samemaxheight' and 'sameminheight' will be used. | |
* | |
* Examples of use: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
from time import sleep | |
import os | |
from twitter import * | |
from random import choice | |
from datetime import datetime | |
op1 = 11 | |
op2 = 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Utils; | |
class Greeting | |
{ | |
protected counter1 = 0; | |
protected counter2 = 0; | |
protected counter3 = 0; | |
protected revcounter1 = 5; | |
protected revcounter2 = 5; | |
protected revcounter3 = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* | |
* <img src="pic.jpg" data-colour="blue" /> | |
* <img src="pic.jpg" data-colour="green" data-contrast="40" /> | |
* <img src="pic.jpg" data-colour="pink" data-brightness="30" /> | |
* <img src="pic.jpg" data-colour="#ddc258" data-contrast="40" data-brightness="30" /> | |
* <script>$(function(){ $(img['data-colour']).toner(); });</script> | |
*/ | |
;(function ($, window, document, undefined) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change the colour of the base directory depending on whether | |
# I'm in the live/staging/dev areas. Also show the user and host | |
# as well as the bash history number of the command. | |
C_DEV="\[\033[0;32m\]" # green | |
C_STAGE="\[\033[0;33m\]" # yellow | |
C_LIVE="\[\033[1;31m\]" # bold red | |
C_PATH="\[\033[0;37m\]" # white | |
C_COUNT="\[\033[0;36m\]" # cyan | |
C_NONE="\[\033[0m\]" # reset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var txt = $('.content')[0].text(), | |
charCount = txt.length, | |
wordCount = txt.replace(/[^\w ]/g, "").split(/\s+/).length; | |
$('#somwhereInYourDocument').text("The text had " + charCount + " characters and " + wordCount +" words"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from RPi import GPIO | |
from time import sleep | |
import subprocess | |
clk = 5 | |
dt = 6 | |
btn = 26 | |
# vals from output of amixer cget numid=1 | |
min = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first make sure MP4Box is install | |
sudo apt-get install gpac | |
# then run this from the command line | |
for i in *.h264; do MP4Box -add $i ${i%.*}.mp4; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: https://stackoverflow.com/a/36079484 | |
// The unsorted data | |
let data = { | |
a: 'A', | |
c: 'C', | |
b: 'B' | |
}; | |
// Create it sorted |
OlderNewer