Skip to content

Instantly share code, notes, and snippets.

View yamini's full-sized avatar

Yamini yamini

  • Gretel
  • 00:56 (UTC -12:00)
  • LinkedIn in/yamini
View GitHub Profile
@Kartones
Kartones / postgres-cheatsheet.md
Last active August 19, 2025 12:12
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@markhamstra
markhamstra / Greeter.scala
Created April 29, 2014 20:38
Scheduler exception handling
package sample.hello
import akka.actor.Actor
object Greeter {
case object Greet
case object Done
}
class Greeter extends Actor {
@peterjaap
peterjaap / magento-testing-scenarios.md
Last active May 13, 2025 08:03
Magento testing scenarios

Magento testing scenarios

For use after an upgrade to verify the correct working of Magento

SHIP IT

Frontend

General

  • Activate all logs on the server (PHP, MySQL, Magento, mail, etc)
  • Check meta tags in HTML
@James1x0
James1x0 / momentjs.humanized.triplesplit.time.js
Created January 15, 2014 19:42
Get a humanized, "Morning", "Afternoon", "Evening" from moment.js **Great for user greetings!**
function getGreetingTime (m) {
var g = null; //return g
if(!m || !m.isValid()) { return; } //if we can't find a valid or filled moment, we return.
var split_afternoon = 12 //24hr time to split the afternoon
var split_evening = 17 //24hr time to split the evening
var currentHour = parseFloat(m.format("HH"));
if(currentHour >= split_afternoon && currentHour <= split_evening) {
@danharper
danharper / background.js
Last active August 13, 2025 02:58
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@steveosoule
steveosoule / htaccess-force-files-to-download.txt
Created December 6, 2013 00:29
.htaccess - Force Files to Download in a Browser
# From http://css-tricks.com/snippets/htaccess/force-files-to-download-not-open-in-browser/
AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf
@chluehr
chluehr / varnishclear.sh
Created December 3, 2013 10:04
Bash script to clear all resources / files / path of a (sub-) domain in a varnish cache.
#/!bin/bash
cmd="sudo varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret"
site=$(echo $1 | sed -r 's|https?://||;s|/(.*)||;')
page=$(echo $1 | awk -F'/' -v OFS='/' '{sub(/https?:\/\//, ""); $1=""; print $0}')
if [ -z "$1" ]; then
echo "ERROR: please provide a URL to purge.."
echo "USAGE: "
<?php
/**
* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used
*/
$callbackUrl = "http://yourdomain.com/magento-create-product-rest-api.php"; // the URL of this file
$temporaryCredentialsRequestUrl = "http://yourdomain.com/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://yourdomain.com/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://yourdomain.com/oauth/token';
$apiUrl = 'http://yourdomain.com/api/rest';
$consumerKey = 'v3b7p1yn29q0378ybk9w5d7hrsmiifpf';
@tylerneylon
tylerneylon / learn.lua
Last active July 8, 2025 14:39
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
<?php
// cleanup.php?clean=var
// cleanup.php?clean=log
$xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;