Skip to content

Instantly share code, notes, and snippets.

@bramus
bramus / bookmarklet.md
Last active August 3, 2023 16:56
Mastodon User Page Bookmarklet
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@jodyheavener
jodyheavener / Instructions.md
Created August 18, 2015 04:55
Use Babel (ES6) with Sails JS

Inspired by this issue, with these instructions you should be able to get Babel transpiling your JS in Sails JS for the client side.

  1. Install Grunt Babel npm install --save grunt-babel
  2. Create a babel.js file under tasks/config and add something like the following:
module.exports = function(grunt) {

    grunt.config.set('babel', {
dev: {
# How to use PG Point type in SQAlchemy
#
# Most of the code comes from here:
# http://initd.org/psycopg/docs/advanced.html#adapting-new-types
import re
import sqlalchemy
import psycopg2
from psycopg2.extensions import adapt, register_adapter, AsIs
@jareware
jareware / SCSS.md
Last active February 13, 2024 14:33
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@michaelp85
michaelp85 / ExtExpressionEngineAuthDB.php
Created February 6, 2013 02:30
MediaWiki external authentication plugin interface to ExpressionEngine 2.2+
<?php
/**
* External authentication plugin interface to ExpressionEngine 2.2+
*
* Basic setup:
* - Save this file into extensions/ExtExpressionEngineAuthDB/ExtExpressionEngineAuthDB.php
* - Insert LocalSettings.php requirements, see below for what they are.
*
* This extension is a derivation of http://www.mediawiki.org/wiki/Extension:ExtAuthDB
*
@madrobby
madrobby / gist:2997187
Created June 26, 2012 17:13
The ultimate media query to rule them all ("all" being high DPI/"Retina" screens)
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
/* "retina" styles */
}
@tondol
tondol / entry.rb
Created April 12, 2012 17:30
Markov Twitter Bot
# -*- coding: utf-8 -*-
require_relative 'twitterbot'
Twitter.configure {|config|
config.consumer_key = 'consumer key'
config.consumer_secret = 'consumer secret'
config.oauth_token = 'oauth token'
config.oauth_token_secret = 'oauth token secret'
}
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {