Skip to content

Instantly share code, notes, and snippets.

<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@jamesgecko
jamesgecko / cmd-hijack.js
Created July 28, 2014 20:13
Stop Cmd shortcut hijacking in Firefox
// ==UserScript==
// @name Disable interceptions of Cmd+t, Cmd+w, Cmd+shift+] and Cmd+shift+[
// @namespace http://userscripts.org/users/642403
// @description Stop websites from hijacking keyboard shortcuts
//
// @run-at document-start
// @include *
// @grant none
// ==/UserScript==
@jamesgecko
jamesgecko / change-status-from-wifi.applescript
Created September 18, 2014 18:03
Use this script with Adium to set your status message based on what wifi network you're connected to. In Adium's Preferences, on the Events tag, edit or add the "You connect" event and add "Run the AppleScript 'change-status-from-wifi'"
set mySSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
if mySSID is "HomeNetwork" then
set message to "Working from home"
end if
if mySSID is "WorkNetwork" then
set message to "Working from the office"
end if
tell application "System Events"
if exists process "Adium" then tell application "Adium" to set status message of every account to message
end tell
@jamesgecko
jamesgecko / devurl
Created November 4, 2014 20:36
Get my current development url on OS X
#!/bin/sh
interface=$(route get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}')
domain="http://$(ipconfig getifaddr $interface):3000"
echo $domain

Learn to Program

I want awesome general purpose development tools

  • Atom is the best easy-to-learn free text editor right now.
  • Git is a great versioning tool with a somewhat confusing interface.
  • ConEmu is a nice Windows command line replacement when you eventually get sick of the default one.

I want to learn practical Python stuff

-- Recive a HTTP POST and relay it
-- Author: Waqas Hussain
-- Derived from mod_post_msg by Kim Alvefur <zash@zash.se>
-- Some code borrowed from mod_webpresence
--
-- Example usage:
-- curl http://example.com:5280/presence/user -d "Hello there"
-- or
-- curl http://example.com:5280/presence/user@example.com -d "Hello there"
@jamesgecko
jamesgecko / session_controller.rb
Created April 28, 2011 16:09
In which James learns that redirect_to is not instant.
class SessionController < ApplicationController
def index_attempt_one
if !session[:unset_key]
redirect_to :action => 'login'
end
# Anything here gets executed too! D-:
end
def index_attempt_two
if !session[:unset_key]
NoMethodError in Support_calls#new
Showing c:/Users/james/code/support/app/views/support_calls/_form.html.erb where line #28 raised:
undefined method `resolved' for #<SupportCall:0x1254fcd>
Extracted source (around line #28):
25: </div>
26: <div class="checkbox">
class SupportCallsController < ApplicationController
def new
@support_call = SupportCall.new
@customers = Customer.all
end
def create
@support_call = SupportCall.new(params[:support_call])
respond_to do |format|