Skip to content

Instantly share code, notes, and snippets.

@btranscend
btranscend / facebook-page-invite.js
Created August 6, 2018 20:05 — forked from guiliredu/facebook-page-invite.js
Facebook - Script to auto invite people who liked a page post do like the page
var buttons;
buttons = document.getElementsByClassName('_42ft');
for (var i = 0; i < buttons.length; i++) {
if(buttons[i].getAttribute('ajaxify') != null){
if(buttons[i].getAttribute('ajaxify').indexOf('invite') != -1){
buttons[i].click();
}
}
}
@btranscend
btranscend / any_django_migrations.py
Created April 1, 2017 00:09
Django migration patching (dirty, doch!) JSONField for databases other than PostgreSQL to TextField. Useful when running tests on local machine without postgres server running.
def patch_migration_jsonfield(apps, schema_editor):
if schema_editor.connection.vendor == 'postgres':
return
for operation in Migration.operations:
field_stack = list()
if hasattr(operation, 'fields'):
for field in operation.fields:
name, field_cls = field
if field_cls.__class__ == django.contrib.postgres.fields.jsonb.JSONField:
@btranscend
btranscend / gist:3df5f4db26d65693e43bc57e3807d573
Created April 1, 2017 00:09 — forked from AlexZeitler/gist:3312858
Renaming entities with RavenDb patching API
using System.Linq;
using System.Threading;
using Raven.Abstractions.Data;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Json.Linq;
using Xunit;
namespace RavenDbPatching.StringIdPatching {
@btranscend
btranscend / gist:1d235ad3c4331b2caafc2340212677b5
Created April 1, 2017 00:09 — forked from AlexZeitler/gist:3312858
Renaming entities with RavenDb patching API
using System.Linq;
using System.Threading;
using Raven.Abstractions.Data;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Json.Linq;
using Xunit;
namespace RavenDbPatching.StringIdPatching {
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="website">
<patch:attribute name="database">master</patch:attribute>
</site>
</sites>
</sitecore>
</configuration>
@btranscend
btranscend / create_cluster.sh
Created April 1, 2017 00:06 — forked from hanada/create_cluster.sh
creates a new PostgreSQL database cluster
#!/bin/sh
BASE_PATH=`pwd`
export PGDATA=$BASE_PATH/data
export PGUSER=postgres
export ARCLOG_PATH=$BASE_PATH/arclog
# determine target PostgreSQL version
VERSION=`pg_config --version | sed 's/^PostgreSQL //'`