Skip to content

Instantly share code, notes, and snippets.

View barinbritva's full-sized avatar
🏴‍☠️
Karibu!

barinbritva

🏴‍☠️
Karibu!
View GitHub Profile
@mbijon
mbijon / xss_clean.php
Last active November 1, 2022 03:23
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
<?php
/*
* XSS filter, recursively handles HTML tags & UTF encoding
* Optionally handles base64 encoding
*
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011
* A MAINTAINED & BETTER ALTERNATIVE => kses
* https://github.com/RichardVasquez/kses/
*
* This was built from numerous sources
@jaxbot
jaxbot / gist:5748513
Created June 10, 2013 12:58
Block nginx from serving .git directories
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
/*
Do not modify this version of the file. It will be copied over when any of the project's targets are built.
If you wish to modify mraid.js, modify the version located at mopub-sdk-common/mraid/mraid.js.
*/
(function() {
var isIOS = (/iphone|ipad|ipod/i).test(window.navigator.userAgent.toLowerCase());
if (isIOS) {
console = {};
console.log = function(log) {
var iframe = document.createElement('iframe');
@JArmando
JArmando / ReactAnimations.md
Last active August 31, 2017 15:36
React Animations using animate.css

ReactAnimations with animate.css:

Say you want to animate a list of items. Wrap these children components in a <ReactCssTransitionGroup> and set the animation settings (duh) similar to this:

//… the rest of the component declaration
// … this goes in the render function
render: function(){
	var ReactCssTransitionGroup = React.addons.cssTransitionGroup;
@ethaizone
ethaizone / server_time_sync.js
Last active December 16, 2022 12:37
Sync server time to client browser with JS. Implement follow Network Time Protocol.
// Thanks http://stackoverflow.com/questions/1638337/the-best-way-to-synchronize-client-side-javascript-clock-with-server-date
var serverTimeOffset = false;
function getServerTime(callback) {
if (serverTimeOffset === false) {
var scripts = document.getElementsByTagName("script"),
URL = scripts[scripts.length - 1].src;
var clientTimestamp = Date.parse(new Date().toUTCString());
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@SteveL-MSFT
SteveL-MSFT / profile.ps1
Last active March 11, 2024 01:21
PowerShell Prompt
#Requires -Version 7
# Version 1.2.13
# check if newer version
$gistUrl = "https://api.github.com/gists/a208d2bd924691bae7ec7904cab0bd8e"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {
@noamtamim
noamtamim / README.md
Last active April 29, 2024 13:13
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@josdejong
josdejong / npm.js
Last active March 14, 2024 22:28
Helper function to load ESM packages from NPM in your browser dev tools console
/**
* Load an ESM package from npm in your JavaScript environment.
*
* Loads packages from https://www.npmjs.com/ via the CDN https://www.jsdelivr.com/
*
* Usage:
*
* const lodash = await npm('lodash-es')
* const lodash = await npm('lodash-es@4')
* const lodash = await npm('lodash-es@4.17.21')