Skip to content

Instantly share code, notes, and snippets.

View rlemon's full-sized avatar
🍋
Hanging around.

Robert Lemon rlemon

🍋
Hanging around.
  • Dryer Moisture Systems Inc.
  • Kitchener, Ontario. Canada.
View GitHub Profile
@rlemon
rlemon / Notifier.js
Created February 6, 2012 14:32
Files from SSI
var Notifier = (function() {
var Notifier = function(config) {
this.config = {
defaultTimeOut: 5000,
position: ["top", "right"],
notificationStyles: {
padding: "12px 18px",
margin: "0 0 6px 0",
backgroundColor: "#000",
opacity: 0.8,
@rlemon
rlemon / gist:1752553
Created February 6, 2012 15:02
Planning Pages

##Pages

  • Login
    • Forgot Password
    • Register
  • Dashboard
    • Information (default)
      • View Information (default)
      • Change Username/Email/Password
  • Delete Account

###Features

####Simple

  • Basic auth options (login, logout, register, unregister).
  • Very compact (less than 20 files and 4 DB-tables).
  • Username is optional, only email is obligatory.

####Secure

  • Using phpass library for password hashing (instead of unsafe md5).
  • Counting login attempt for bruteforce preventing (optional). Failed login attempts determined by IP and by username.
@rlemon
rlemon / gist:1770422
Created February 8, 2012 15:24
Deep Object Merge in js
function merge(target, obj) {
var ret = {};
for (var prop in obj) {
if (target.hasOwnProperty(prop) && obj.hasOwnProperty(prop)) {
if (typeof(target[prop]) === "object" && typeof(obj[prop]) === "object") {
ret[prop] = merge(target[prop], obj[prop]);
} else {
ret[prop] = obj[prop];
}
} else if (obj.hasOwnProperty(prop)) {
@rlemon
rlemon / gist:1774163
Created February 8, 2012 21:48
Easy Table Editor
<?php
class Database extends PDO {
public function __construct() {
parent::__construct( DB_TYPE . ':host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USER, DB_PASS );
}
}
$dbh = new Database();
if( !isset( $_GET['tablename'] ) ) {
die('<form method="get"><label>Table Name: <input type="text" name="tablename" /></label><input type="submit" value="Lookup Table" /></form>');
@rlemon
rlemon / gist:1780212
Created February 9, 2012 14:12
PHP get CPU information from /proc/stat
<?php
/* Gets individual core information */
function GetCoreInformation() {
$data = file('/proc/stat');
$cores = array();
foreach( $data as $line ) {
if( preg_match('/^cpu[0-9]/', $line) )
{
$info = explode(' ', $line );
$cores[] = array(
@rlemon
rlemon / sechatty.user.js
Created February 10, 2012 20:58
SE Chat Emoticons userscript
// ==UserScript==
// @name SE Chat Emoticons
// @author Robert Lemon
// @namespace http://rlemon.com
// @description Replaces frequently used emoticons with images in the chat system.
// @include http://chat.stackexchange.com/rooms/*
// @include http://chat.stackoverflow.com/rooms/*
// ==/UserScript==
/* RIGHT NOW I LAGG REALLY BAD */
@rlemon
rlemon / SAVE.XML
Created February 14, 2012 21:39
Schema D
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ -->
<!-- Active URL: http://ondras.zarovi.cz/sql/demo/ -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/>
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/>
<type label="Single precision" length="0" sql="FLOAT" quote=""/>
@rlemon
rlemon / gist:1837085
Created February 15, 2012 16:30
Liddle Command List (Planning)

OK, so I need a simple way for people to add/contribute command key ideas... See Project Page HERE

Please follow this format:

<command-key-combination>

  • <what to do when nothing is selected>
  • <what to do when a range is selected>
@rlemon
rlemon / demo.markdown
Created February 24, 2012 14:28
Paper in CSS