Skip to content

Instantly share code, notes, and snippets.

@gherkins
gherkins / index.ts
Created March 11, 2024 16:28 — forked from endrsmar/index.ts
Raydium new pool listener
import { LiquidityPoolKeysV4, MARKET_STATE_LAYOUT_V3, Market, TOKEN_PROGRAM_ID } from "@raydium-io/raydium-sdk";
import { Connection, Logs, ParsedInnerInstruction, ParsedInstruction, ParsedTransactionWithMeta, PartiallyDecodedInstruction, PublicKey } from "@solana/web3.js";
const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com';
const RAYDIUM_POOL_V4_PROGRAM_ID = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8';
const SERUM_OPENBOOK_PROGRAM_ID = 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
const SOL_DECIMALS = 9;
const connection = new Connection(RPC_ENDPOINT);
{
"meta": {
"theme": "stackoverflow"
},
"basics": {
"name": "Max Girkens",
"label": "Web Development",
"summary": "",
"website": "https://web-development.cc/",
"city": "Aachen",
@gherkins
gherkins / CachedMySQLDatabase.php
Created May 14, 2015 13:10
CachedMySQLDatabase - stores results of SELECT queries as arrays and reuses those... not sure if this is a good idea, though
<?php
/**
* Class CachedMySQLDatabase
* @inheritdoc
*/
class CachedMySQLDatabase extends MySQLDatabase
{
protected $cache = array();
@gherkins
gherkins / CachedMySQLDatabase.php
Created May 14, 2015 10:50
cache identical queries
<?php
/**
* Class CachedMySQLDatabase
* @inheritdoc
*/
class CachedMySQLDatabase extends MySQLDatabase
{
protected $cache = array();
(function(){
var v = "1.3.2";
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
@gherkins
gherkins / image_xml_sitemap.php
Created October 20, 2012 17:04
Create Google (Image) XML Sitemaps using PHP
header("Content-type: text/xml; charset=utf-8");
//create your XML document, using the namespaces
$urlset = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" /><!--?xml version="1.0" encoding="UTF-8"?-->');
//iterate over your sites pages or whatever you like
foreach (getMyPagesOrWhatEver() as $item):
//add the page URL to the XML urlset
@gherkins
gherkins / jquery.magnetic.js
Created July 25, 2012 18:42
some experimental minimal plugin for fix/unfix position of a container inside another container...
(function($) {
$.fn.magnetic = function(options) {
var obj = this.find(options.selector);
var initialLeft = parseInt(obj.css('left'));
var mainOffset = this.offset().left;
var fixAt = (initialLeft - options.left ) + mainOffset;
this.on('scroll', function() {
@gherkins
gherkins / silverstripe_duplicate_relations.php
Created March 10, 2012 23:41
Silverstripe – has_many- and many_many-relations when duplicating pages
<?php
public function duplicate() {
$items_to_duplicate = array(
'Images',
'Somehting'
);
$page = parent::duplicate();
@gherkins
gherkins / install_silverstripe.sh
Created September 11, 2011 12:07
install silverstripe + common modules from github
# install silverstripe + common modules from github
# usage sh install_silverstripe.sh <folder_name> <tag/branch>
# examples:
# sh install_silverstripe.sh some_folder tags/2.4.5
# sh install_silverstripe.sh some_folder master
#set up project base folder
git clone git@github.com:silverstripe/silverstripe-installer.git $1
cd $1
git checkout $2
@gherkins
gherkins / scrollToViewPort.js
Created June 10, 2011 13:41 — forked from dejoe/scrollToViewPort.js
Jquery Scroll To View Port
jQuery.fn.scrollToViewPort = function(options) {
var animTimeInterval = (typeof options.interval == "undefined")?"slow":animTimeInterval;
return this.each(function(){
var offSet = (typeof options.offset == "undefined")? $(this).offset().top : options.offset;
if( $(this).offset().top <= $(window).scrollTop() || ( $(this).offset().top + $(this).height() ) >= ( $(window).scrollTop() + $(window).height() ) ){
$('html,body').animate( { scrollTop: offSet }, animTimeInterval );
}
});
}