Skip to content

Instantly share code, notes, and snippets.

@flaviut
flaviut / Setting up Emporia Vue 2 with ESPHome.md
Last active August 22, 2024 18:14
Setting up Emporia Vue 2 with ESPHome
@rubyandcoffee
rubyandcoffee / Ruby with chruby
Last active November 12, 2024 21:36
chruby - Installing and managing Ruby versions
To install chruby and ruby-install:
brew install chruby ruby-install
To install Ruby using ruby-install:
ruby-install ruby 2.7.1
NOTE: You can find latest stable version of Ruby here: https://www.ruby-lang.org/en/downloads/
If you have issues installing Ruby then try the following:
brew install openssl@3
ruby-install 3.2.2 -- --with-openssl-dir=$(brew --prefix openssl@3)
@tado
tado / tidalForwardOsc.scd
Last active March 19, 2021 13:58
Forwarding TidalCycles OSC messages via SuperCollider
SuperDirt.start
(
//forward OSC message (localhost, port 3333)
var addr = NetAddr.new("127.0.0.1", 3333);
OSCdef(\tidalplay2, {
arg msg;
addr.sendMsg("/play2", *msg);
}, '/play2', n);
)
#!/bin/bash
if [ -z $1 ]
then
echo 'Sitemap must be provided as first argument.';exit 2
fi
# Helper function to read xml
read_dom () {
local IFS=\>
@aurimasniekis
aurimasniekis / merger.php
Last active December 3, 2015 03:51
Funct multi file function merger to single file
<?php
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
require_once __DIR__ . '/vendor/autoload.php';
$groups = ['Collection', 'String', 'Objects'];
foreach ($groups as $groupName) {
@monostere0
monostere0 / GlobalEvents.js
Last active February 19, 2020 08:10
Fire events between different browser windows using localStorage.
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
@molotovbliss
molotovbliss / example.php
Last active November 10, 2018 00:12
Running multiple processes in PHP
<?php
set_time_limit(0);
include "threads.php";
$commands = array('ffmpeg -i '.$inputFile[0].' '.$outputFile[0].' 2>&1','ffmpeg -i '.$inputFile[0].' '.$outputFile[0].' 2>&1');
$threads = new Multithread($commands);
$threads->run();
foreach ($threads->commands as $key=>$command){
echo "Command ".$command.":<br>";
echo "Output ".$threads->output[$key]."<br>";
echo "Error ".$threads->error[$key]."<br><br>";
@philwinkle
philwinkle / ce-1.6.2.0\app\code\core\Mage\Usa\Model\Shipping\Carrier\Fedex.php
Last active October 7, 2016 00:38
Git diff of Fedex SOAP API endpoint change - CE 1.6, 1.7, 1.8 and EE 1.11, 1.12, 1.13
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
index d567b6e..9a98440 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
@@ -119,8 +119,8 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex
{
$client = new SoapClient($wsdl, array('trace' => $trace));
$client->__setLocation($this->getConfigFlag('sandbox_mode')
- ? 'https://wsbeta.fedex.com:443/web-services/rate'
- : 'https://ws.fedex.com:443/web-services/rate'
@rgranadino
rgranadino / memleak.php
Last active August 29, 2015 13:55
Magento Memory Leak
<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL);
require 'app/Mage.php';
Mage::app('admin', 'store');
/* @var $customers Mage_Customer_Model_Resource_Customer_Collection */
$customers = Mage::getResourceModel('customer/customer_collection');
$customers->addAttributeToSelect('*');
$customers->setPageSize((isset($argv[1]) && is_numeric($argv[1]))?$argv[1]:2000);
@peterjaap
peterjaap / Mage_Catalog_Model_Resource_Url_getProduct.php
Last active May 4, 2017 06:09
Modified Mage_Catalog_Model_Resource_Url::_getProduct function. This function now contains a boolean that you can set to switch between rewriting the URL's for ALL products and rewriting only the URL's of products that are visible. Idea inspired by Alan Storm's blog on Scaling Magento - http://alanstorm.com/scaling_magento_at_copious
<?php
protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
{
$products = array();
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$adapter = $this->_getReadAdapter();
if ($productIds !== null) {
if (!is_array($productIds)) {
$productIds = array($productIds);