Skip to content

Instantly share code, notes, and snippets.

@OrganicPanda
OrganicPanda / test.py
Created February 3, 2012 11:51
A basic CherryPy/SQLAlchemy example site to demonstrate a multi-user issue
import cherrypy
import sqlalchemy
from sqlalchemy import Table, Column, ForeignKey, MetaData, Integer, String
from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relationship
from sqlalchemy.orm.properties import ColumnProperty
from sqlalchemy.orm.util import object_mapper
# The base class from which all entities will extend
class BaseEntity(object):
def __repr__(self):
@OrganicPanda
OrganicPanda / 1. Install Node.md
Last active December 20, 2015 14:49
Various helper Gists for setting up projects
@OrganicPanda
OrganicPanda / windows.md
Last active December 27, 2015 14:39
Windows instructions for Alfonzo's blog post
@OrganicPanda
OrganicPanda / hacky-scrollbar-resize-listener.js
Last active April 7, 2024 10:53
A sham that will throw a window resize event even when scrollbars are added/removed (this is not something the standard window resize event does). Tested in IE9+, Chrome & Firefox latest.
// Demo: http://jsfiddle.net/pFaSx/
// Create an invisible iframe
var iframe = document.createElement('iframe');
iframe.id = "hacky-scrollbar-resize-listener";
iframe.style.cssText = 'height: 0; background-color: transparent; margin: 0; padding: 0; overflow: hidden; border-width: 0; position: absolute; width: 100%;';
// Register our event when the iframe loads
iframe.onload = function() {
// The trick here is that because this iframe has 100% width
/**
* Juan's leaving card: http://is.gd/juan_leaving
*/
(function() {
'use strict';
var message = [
' gg ',
' dP8, ',
' dP Yb ',

#Linux Mint#

Layout

Change the keyboard to English (UK, Macintosh) in Preferences > Region and Language > Layouts tab.

Super/CTRL Keys

Add the following lines to ~/.Xmodmap:

Keybase proof

I hereby claim:

  • I am OrganicPanda on github.
  • I am organicpanda (https://keybase.io/organicpanda) on keybase.
  • I have a public key whose fingerprint is A583 A585 7B9D 2DD4 E60A ECBB AF5D 91DA A10A E031

To claim this, I am signing this object:

Set up OSX

Install Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew doctor
@OrganicPanda
OrganicPanda / foo.js
Last active August 29, 2015 14:18
Restangular Service
.factory('Search', function(Restangular, Me, constants) {
var profile = Restangular.one(constants.PROFILES, Me.get().view.of.id)
, serviceWithProfile = Restangular.service(constants.SEARCHES, profile)
, serviceNoProfile = Restangular.service(constants.SEARCHES);
serviceWithProfile.oneToOnes = function() {
return serviceWithProfile.getList({
searchType: constants.SEARCHES_ONE2ONE_TYPE
});
};
const screenshot = (text = '') => {
const upload = filename => {
const util = require('util');
const exec = require('child_process').exec;
const command = 'curl -sbv ' +
'-H \'Content-Type: multipart/form-data\' ' +
'-H \'Accept: application/json\' ' +
'-F "file=@./' + filename + '" ' +
'-F "upload_preset=kzrkwuhx" ' +