Skip to content

Instantly share code, notes, and snippets.

@rittme
rittme / Codeigniter: Default Controller
Created March 11, 2012 12:21
Codeigniter: Default codeigniter controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*/
public function index()
{
@rittme
rittme / CSS: image replacement
Created March 11, 2012 12:27
CSS: image replacement
.ir {
border:0;
font: 0/0;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@rittme
rittme / JavaScript: jQuery PubSub
Created March 11, 2012 12:31
JavaScript: jQuery PubSub
(function($) {
var p = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api) {
$[api] = function() {
o[key].apply( o, arguments );
@rittme
rittme / cloudflare_ddns.py
Last active January 2, 2016 11:28
Dynamic DNS update script for CloudflareUpdates a set of A records through Cloudflare API to the machine current IP address
#!/usr/bin/python
# Update a set of A records in Cloudflare with the machine current IP address
#
# If you don't know your domain information (like id), you should run:
#
# curl https://www.cloudflare.com/api_json.html \
# -d 'a=rec_load_all' \
# -d 'tkn=CLOUDFLARE_TOKEN' \
# -d 'email=MY_EMAIL' \
@rittme
rittme / selogerfind.py
Last active August 29, 2015 13:56
seloger auto search for new housing
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from urllib import urlencode
import urllib2
import json
import smtplib
from pprint import pprint
FILE_NAME = "selogerRefs.json"
@rittme
rittme / README.md
Last active August 29, 2015 14:26 — forked from jonalmeida/README.md
Notifies you when your try build is complete.

Why

Instead of checking when your try build is complete, this short python script checks try every 5 mins (you can change the interval if you like) using the treeherder API to see if your try push is complete. Gives you a simple notification in your Notification Center (on Mac OS).

How To Use

  • chmod +x try_to_notify
  • (Optional) Move to your /usr/local/bin and remove .py extension
  • try_to_notify [sha_of_the_try_push]

Examples

@rittme
rittme / userChrome.css
Created June 24, 2016 23:33
Firefox custom userChrome to make vertical tabs look more like Tab Center.
#verticaltabs-splitter {
min-width: 0 !important;
background: none !important;
}
#verticaltabs-box:hover + #verticaltabs-splitter, #verticaltabs-splitter:hover {
min-width: 2px !important;
}
#TabsToolbar {
@rittme
rittme / components.my-component.js
Last active November 20, 2017 07:27
TEST LIFECYCLE
import Ember from 'ember';
export default Ember.Component.extend({
computed: Ember.computed(function() {
console.log('I was computed');
return 'on compute me';
}),
_onDidReceiveAttrs: Ember.on('didReceiveAttrs', function () {
console.log(`COMPUTED ${this.get('computed')}`);
@rittme
rittme / git-blame-stats.sh
Created June 14, 2021 08:10
show stats of how many lines were changed by author
git ls-tree -r -z --name-only HEAD -- $1 | sed 's/^/.\//' | xargs -0 -n1 git blame \
--line-porcelain HEAD |grep -ae "^author "|sort|uniq -c|sort -nr
@rittme
rittme / context.json
Created June 19, 2023 02:49
VS Code snippet: React Context
{
"React Context": {
"scope": "javascript,typescript",
"isFileTemplate": true,
"prefix": "context",
"body": [
"import React, { createContext, useContext } from 'react';",
"",
"const ${1:Data}Context = createContext(null);",
"",