Skip to content

Instantly share code, notes, and snippets.

View razvanioan's full-sized avatar

Razvan Ioan Anastasescu razvanioan

View GitHub Profile
@molily
molily / filter.txt
Last active June 7, 2022 05:13
SVG filter: White drop shadow
<filter id="dropshadow" x="0" y="0" width="200%" height="200%">
<feColorMatrix in="SourceAlpha" type="matrix"
values="-1 0 0 0 1, 0 -1 0 0 1, 0 0 -1 0 1, 0 0 0 1 0"
result="matrix"/>
<feGaussianBlur in="matrix" stdDeviation="2" result="blur"/>
<feComposite in="SourceGraphic" in2="blur" operator="over"/>
</filter>
@bubba-h57
bubba-h57 / closeConnection.php
Created January 14, 2015 21:39
Easy way to close connections to the browser and continue processing on the server.
<?php
/**
* Close the connection to the browser but continue processing the operation
* @param $body
*/
public function closeConnection($body, $responseCode){
// Cause we are clever and don't want the rest of the script to be bound by a timeout.
// Set to zero so no time limit is imposed from here on out.
set_time_limit(0);
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 2, 2024 05:49
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@dcpesses
dcpesses / photoreflect.js
Last active July 5, 2023 11:41
Re-enable right-click & add Download links to thumbnail pages on PhotoReflect pages.
/*
Copy the single line of code below, then add it as a new bookmark to your web browser of choice:
javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://gist.githubusercontent.com/dcpesses/9652778/raw';})();
Then browse to the thumbnails of the album, click on that bookmark, and...enjoy!
*/
document.oncontextmenu=document.body.oncontextmenu = new Function("return true");
@cleverdevil
cleverdevil / markdown-to-email
Created January 4, 2014 01:06
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---
@rosswd
rosswd / multi-git-win.md
Last active February 28, 2024 09:46
Setting up a Github and Bitbucket account on the same computer on Mac OS. Now with a guide for Windows 10.

Setting up github and bitbucket on the same computer (Windows)

Guide for Windows

mix3d asked for some help using this guide with windows so here we go. This was tested with Windows 10. Run all commands in Git Bash once it's installed.

Github will be the main account and bitbucket the secondary.

Git for Windows

  • Download and install Git for Windows
    • In the installer, select everything but decide if you want a desktop icon (2nd step)
@eric1234
eric1234 / README.md
Last active March 26, 2024 06:17
Environment-based configuration for PHP

Purpose

Somewhat like dotenv but for PHP.

The goals is to remove all config scattered about in files and have one authoritative source for that config info.

Usage

@raveren
raveren / cryptographically_secure_random_strings.php
Last active November 21, 2023 12:35
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer: http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@orangexception
orangexception / gist:3941158
Created October 23, 2012 19:56
Regular Expression to Insert Character after every X Characters

Regular Expression to Insert Character after every X Characters

I had a simple problem today. I needed to validate some files, but all of the line breaks were missing. I was dealing with a fixed width format data. A quick regular expression later and I had readable data.

Here's a few examples to demo the idea.

Insert a line break after every 94 characters

Find (.{94}) Replace \1\n

Insert a comma after every 10 characters

@generalredneck
generalredneck / xpath.php
Created September 27, 2012 18:12
XPath - A Fun Walk With A Powerful Query Language
<?php
require_once 'Console/Table.php';
$groupsDoc = new DOMDocument();
$groupsDoc->load("groups.xml");
$groupsDoc->formatOutput = TRUE;
file_put_contents("readable-groups.xml",$groupsDoc->saveXML());
$xpath = new DOMXpath($groupsDoc);
/*******************************************************************************