Skip to content

Instantly share code, notes, and snippets.

View gnysek's full-sized avatar
💭
Kuwabara! Kuwabara!

gnysek gnysek

💭
Kuwabara! Kuwabara!
View GitHub Profile
@franz-josef-kaiser
franz-josef-kaiser / editor_plugin.js
Created April 23, 2011 18:18
Example plugin for how to add a button to tinymce in wordpress
(function()
{
tinymce.create('tinymce.plugins.BrettsYouTube',
{
init : function(ed, url) {
ed.addButton('brettsyoutube',
{
title : 'brettsyoutube.youtube',
image : 'http://localhost/wordpress/wp-includes/js/tinymce/themes/advanced/img/icons.gif',
onclick : function()
@db
db / jquery.ajax.progress.js
Created May 11, 2011 12:43
add XHR2 progress events to jQuery.ajax
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: function() { console.log("standard progress callback"); },
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);
@mynameispj
mynameispj / Props
Created July 24, 2012 14:55
Estimated reading time in PHP, by Brian Cray
Total props to Brian Cray: http://briancray.com/posts/estimated-reading-time-web-design/
@rosszurowski
rosszurowski / lerp-color.js
Last active March 3, 2023 12:14
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hexadecimal colors
* @param {String} a
* @param {String} b
* @param {Number} amount
* @example
* // returns #7F7F7F
* lerpColor('#000000', '#ffffff', 0.5)
* @returns {String}
*/
@mauricioprado00
mauricioprado00 / product-website.php
Last active July 31, 2020 12:03
magento product website assigner
<?php
/**
* Intellimage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.opensource.org/licenses/osl-3.0.php
@YellowAfterlife
YellowAfterlife / ds_map_iter.gml
Created September 9, 2015 19:47
Comparing various methods of iterating over ds_map
var map = ds_map_create();
var keys = ds_list_create();
var values = ds_list_create();
var num = 10000;
var t, k, v;
for (var i = 0; i < num; i++) {
k = i * 2 + 1;
v = irandom(10);
ds_list_add(keys, k);
ds_list_add(values, v);
@kdzwinel
kdzwinel / main.js
Last active June 7, 2024 08:08
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.
#!/bin/bash
ffmpeg -rtsp_transport tcp \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/102 \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/202 \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/302 \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/402 \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/502 \
-i rtsp://smartiptv:PASSWORD@192.168.2.3/Streaming/Channels/602 \
-filter_complex "
/// Transforms a position from one coordinate system to another
/// This function presumes you're using GameMaker's native camera/view system and are not
/// manually setting custom view/projection matrices. Also if you're drawing your application
/// surface yourself then the coordinate transform *may* not be accurate, but it usually is.
///
/// N.B. The struct returned from this function is declared as static for the sake of efficiency.
/// If you want to store values, don't keep a reference to the struct as it is liable to change!
///
/// N.B. This function does NOT take into account view_set_xport() or view_set_yport(). I've not
/// seen someone use those functions in many years.
@tabularelf
tabularelf / scope rules.gml
Last active May 16, 2024 10:41
GameMaker function/method scope rules
/*
Scope Rules:
Caller == Whoever calls this method/function, is scoped to the caller. This is dependent on if there's an lvalue (lvalue.func()) or not. (for methods, the scope will be undefined).
Instance == Regardless of whoever calls this method/function, it's scoped to the instance that declared it and not the caller. (Or if using method, whatever instance that was passed in the scope that's not "undefined")
*/
// Declared in a script
// Scope == Caller, global (Will work no matter where you call it)
function myFunction() {