Skip to content

Instantly share code, notes, and snippets.

@350d
350d / config.json
Last active Oct 10, 2020 — forked from johannrichard/homebridge
Full install + Systemd Service for Homebridge
View config.json
{
"bridge": {
"name": "Homebridge",
"username": "{MAC}",
"port": 51826,
"pin": "{PIN}"
},
"description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.",
View google_rss.js
function getRSS(url) {
$.getJSON('http://www.google.com/uds/Gfeeds',
{
context: 0,
num: 10,
hl: 'en',
output: 'json',
v: '1.0',
nocache: 0,
q: url
@350d
350d / 1_video.get
Created Nov 20, 2014
VK API / wall.get / video.get for 1 item / video.get for 2 item
View 1_video.get
print_r(json_decode(file_get_contents("https://api.vkontakte.ru/method/video.get?access_token=$token&owner_id=64842982&videos=64842982_170418653")));
stdClass Object
(
[response] => Array
(
[0] => 1
[1] => stdClass Object
(
[vid] => 170418653
@350d
350d / finctions.php
Created Oct 30, 2014
Wordpress: Youtube + Vimeo shortcodes for responsive layout
View finctions.php
function appthemes_add_quicktags() {
if (wp_script_is('quicktags')){
?>
<script type="text/javascript">
QTags.addButton( 'yt_embed', 'Youtube', '[youtube id="', '"]', 'y', 'Youtube Video', 1 );
QTags.addButton( 'vm_embed', 'Vimeo', '[vimeo id="', '"]', 'v', 'Vimeo Video', 2 );
</script>
<?php
}
}
@350d
350d / jquery.raf.js
Created Oct 29, 2014
jQuery RequestAnimationFrame Plugin
View jquery.raf.js
(function(jQuery){
'use strict';
if (!Date.now) Date.now = function() { return new Date().getTime(); };
var animating,
vendors = ['moz', 'webkit'],
W = window;
for (var i = 0; i < vendors.length && !W.requestAnimationFrame; ++i) {
var vp = vendors[i];
@350d
350d / 0.gif
Created Sep 26, 2014
Transparent .GIF 1x1 px Base64 encoded
View 0.gif
data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=
@350d
350d / isie.js
Created Sep 24, 2014
Internet Explorer Browser Detector ( method that does not depend on the navigator.userAgent )
View isie.js
function isIE() {
return typeof document.documentMode == "number" || eval("/*@cc_on!@*/!1");
}
View gist:8e83578ff5b7d826d995
property image_extension_list : {"tif", "tiff", "gif", "png", "pict", "pct", "jpg", "jpeg", "bmp"}
property video_extension_list : {"avi", "mov", "mpg", "mpeg", "wmv", "mp4", "m4a"}
property audio_extension_list : {"mp3", "wav", "aac"}
property archive_extension_list : {"zip", "sit", "tar", "tgz", "gz", "bzip2"}
property documents_extension_list : {"doc", "docx", "pdf", "txt", "xls", "xslx", "ppt"}
property diskAlignLeft : true
property otherAlignLeft : false
property margin : {50, 60, 0, 0} -- {left, top, right, bottom}
property xPadding : 50
property yPadding : 50
@350d
350d / debounce.js
Last active Aug 29, 2015
Javascript debounce
View debounce.js
Function.prototype.debounce = function(delay) {
var timeout, callback = this;
return function() {
clearTimeout(timeout);
timeout = setTimeout(callback, delay);
}
}
@350d
350d / hosts
Created Apr 1, 2014
No More Youtube ADS
View hosts
127.0.0.1 ads.youtube.com
127.0.0.1 s0.2mdn.net
127.0.0.1 s1.2mdn.net
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 static.doubleclick.net