Skip to content

Instantly share code, notes, and snippets.

@m4ttbrock
m4ttbrock / img find
Created August 29, 2012 21:20
Simple script to inject jquery and find all img elements on the page.
(function () {
function loadScript(url, callback) {
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState) { //IE
script.onreadystatechange = function () {
if (script.readyState == "loaded" || script.readyState == "complete") {
@m4ttbrock
m4ttbrock / nginx-nodejs-cors
Last active November 9, 2020 18:06
Nginx Nodejs CORS to subdomain
server {
listen 80;
server_name subdomain.example.com;
access_log /var/log/nginx/example.access.log;
location / {
if ($http_origin ~* (https?://.*\.example\.com(:[0-9]+)?)) {
set $cors "true";
@m4ttbrock
m4ttbrock / index.html
Created June 24, 2016 20:09
Select all anchor tags without target attribute
<a(?=\s|>)(?!(?:[^>=]|=(['"])(?:(?!\1).)*\1)*?\starget=['"])[^>]*>(.|\n|\r)*?<\/a>
@m4ttbrock
m4ttbrock / untitled
Created June 24, 2016 20:40
Any href without (target | ng-click | ng-link), but also has ( href | ng-href )
<a(?=\s|>)(?!(?:[^>=]|=(['"])(?:(?!\1).)*\1)*?\s(target=['"]|ng-click=['"]|ng-link=['"]))(?=(?:[^>=]|=(['"])(?:(?=\1).)*\1)*?\s(href=['"]|ng-href=['"]))[^>]*>
@m4ttbrock
m4ttbrock / fiddle.response.xml
Last active February 21, 2017 23:39
sample xml
<grains>
<g compGrain="false" degen="false" global="false" hide="-1" id="100" inDimMaint="false" insert="0" keyfield="dDay" name="Day" table="d_Days">
<d SCD="0" activeKey="0" dDimMaint="true" dDimMaintColOrder="0" dNum="145" editable="true">
<dName dataType="nvarchar">Bi Month</dName>
<dColumn>CBiMonthName</dColumn>
</d>
<d SCD="0" activeKey="0" dDimMaint="true" dDimMaintColOrder="0" dNum="150" editable="true">
<dName dataType="nvarchar">Calendar Month</dName>
<dColumn>CMonthName</dColumn>
</d>