Skip to content

Instantly share code, notes, and snippets.

View dlugs's full-sized avatar

Sławomir Długosz dlugs

View GitHub Profile
@AJMaxwell
AJMaxwell / cache-warmer.sh
Last active May 26, 2024 21:36
A quick bash script I wrote to prime the cache of all my websites. This script grabs the sitemap of the site you wish to warm, then grep the urls to wget each one to cache it on the server.
#!/bin/bash
#####################################################################################################
# Cache Warmer
#
# Useage: cache-warmer.sh ...args
#
# This script grabs the sitemap of the site you wish to warm, then grep the urls to wget each one
# to cache it on the server. I'm sure there are better ways to do this, but this was a simple enough
# method for my needs. I didn't want to have to type in the urls each time I warmed their cache, so
# I just made simple functions with short names to feed those urls into the cache warming function.
<?php
/**
* Functionality taken from Mage_ImportExport_Model_Import_Entity_Product
*/
class Your_Module_Model_Category_Finder
{
/**
* Categories text-path to ID hash.
*
* @var array
@andreiz
andreiz / classifier.php
Last active July 12, 2022 12:50
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions
anonymous
anonymous / marshal.js
Created December 31, 2012 06:20
NodeJS module to allow unmarshaling of Ruby serialized objects. Works fine for simple objects, but there's no clear way to implement classes, etc.
"use strict";
/**
* @author geoff
*/
var Marshal = (function() {
var debug = false;
var symbols;
var marshal_major = 4, marshal_minor = 8;
@tuongaz
tuongaz / BaseModelManager.php
Created April 1, 2012 03:51
Symfony2 Model Manager
<?php
abstract class BaseModelManager {
protected $em;
protected $class;
protected $repository;
protected $container;
/**
* Constructor.