Skip to content

Instantly share code, notes, and snippets.

@dara-tobi
dara-tobi / cusor-rules
Created March 14, 2025 08:52
AI Rules for Cursor
1. Never delete or replace existing code unless explicitly requested. Always build upon what's already there.
2. Focus only on the specific issue mentioned. Do not attempt to "clean up" or refactor unrelated code.
3. Highlight exactly what you're changing and why. Make it clear which parts of the code are being modified.
4. When fixing errors, address all errors shown in logs at once, not one by one.
5. If suggesting multiple changes, present them in order of importance with clear explanations for each.
@dara-tobi
dara-tobi / js
Created March 25, 2023 10:04
This script appends a button to each tweet on twitter. The button lets you very quickly block the owner of the tweet without needing to go through the regular blocking flow: 1. click the menu option -> 2. click block -> 3. click confirm. The appended button lets you block a user in one step: just click the button that is appended to the tweet.
let isSwBlockClicked = false;
let mutationObserver = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes.length > 0) {
if (mutation.target.querySelector('[data-testid="confirmationSheetConfirm"]') && !mutation.target.querySelector('[data-testid="confirmationSheetConfirm"]').classList.contains('sw-block-button')) {
mutation.target.querySelector('[data-testid="confirmationSheetConfirm"]').classList.add('sw-block-button');
mutation.target.querySelector('[data-testid="confirmationSheetConfirm"]').click();
}
@dara-tobi
dara-tobi / combinations.js
Created April 29, 2020 10:44 — forked from axelpale/combinations.js
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@dara-tobi
dara-tobi / node_crypto.js
Created March 5, 2020 11:54 — forked from rojan/node_crypto.js
Encrypt in nodejs and decrypt in php or vice versa
var crypto = require('crypto');
var key = 'MySecretKey12345';
var iv = '1234567890123456';
var cipher = crypto.createCipheriv('aes-128-cbc', key, iv);
var decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
var text = 'plain text';
var encrypted = cipher.update(text, 'utf8', 'binary');
encrypted += cipher.final('binary');
hexVal = new Buffer(encrypted, 'binary');
@dara-tobi
dara-tobi / meta-tags.md
Created February 9, 2020 16:17 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@dara-tobi
dara-tobi / branch-fu.md
Created August 29, 2019 08:08 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@dara-tobi
dara-tobi / dijkstra.js
Created January 31, 2018 21:08 — forked from MoeweX/dijkstra.js
Dijkstra's Algorithm in Javascript using a Weighted Graph
// Changes to original version
// 1. Calculate the distance between any nodes in the dataset, without needing to edit the problem dictionary.
// 2. Prevent algorithm from going back to start node if loops exist in graph (e.g., in problem below)
const problem = {
start: {A: 5, B: 2},
A: {start: 1, C: 4, D: 2},
B: {A: 8, D: 7},
C: {D: 6, finish: 3},
D: {finish: 1},
@dara-tobi
dara-tobi / sample tweets
Created September 13, 2017 17:14
sample tweets to test duplication with
var tweets = ["would 100% recommend 'Atypical' on Netflix to everyone! Such an eye opening show💙",
"Oh, wow! It seems I’m the best dressed at the party! #SUPERSTARLIFE https://t.co/spJAk7HS90 https://t.co/Abv1TxNgA9",
"So many good shows n movies on Netflix. Bout to get on my lazy shit n start watch stuff again",
"May yo|r life one day ;e as awesome ar you pretend it is on vacebook!!",
"I'll get to watch sunrise thanks to the bus ride it's turning into a good day",
"Do you read My articles on @theurbantwist? Best Buy Says the Pricing of $43 Dasani Water Cases in Houston was ‘... https://t.co/hotjUDYDhM",
"Betting and Casino Players, get great offers from the best online casinos and bookies, Follow US...",
"And if you want to see about a hundred more best moments, check out the book This Ain't No Holiday Inn.",
"https://t.co/J6Hd6K6cmt",
"The best Italian music 1 world music (11/09/2016) (02/10/2016) Depeche Mode Stripped",
@dara-tobi
dara-tobi / OOP.php
Created September 27, 2015 11:11
A brief usage of interfaces, traits and inheritance in PHP
<?php
namespace Dara;
interface AnimalInfoTemplate
{
public function getAnimal($name);
public function deleteAnimal($name);
}
@dara-tobi
dara-tobi / PDO_workout.php
Created September 26, 2015 16:23
A PDO class extension with custom methods with which to manipulate a mysql database
<?php
namespace Dara\Db;
/**
* Class for Mysql database manipulation
*/
class MysqlPDO extends \PDO
{
/**
* Create a new database to work with