Skip to content

Instantly share code, notes, and snippets.

<?php
/*!
* Class db
* (c) Stephen Middleton 2010
* Liscensed under the MIT Liscense
* <http://www.opensource.org/licenses/mit-license.html>
* Provides a Filesystem JSON-store to store information in a document Fashion
* See <http://www.json.org> for more information on the JSON format.
*
* Usage::
/*!
* $.expressions
* (c) Stephen Middleton 2010
* Licensed under the MIT license
* <http://www.opensource.org/licenses/mit-license.html>
* Makes an easier modifying method to add Psuedo Expressions
* Syntax::
* //no variables
* $.expressions("hasText", function(ArgumentsArray, LocationInList, List){
* //if returns true, it will be in the list, otherwise it's be filtered out
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.2, 09.03.2009
* by Andreas Eberhard, andreas.eberhard@gmail.com
* http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*
@AlyxRen
AlyxRen / jquery.extTmpl.js
Created October 15, 2010 17:01
Load a template file from a external source on the same domain. supports passing AJAX data for dynamic templates, as well as caching.
(function($){
var cache, defaults;
cache = {};
defaults = {
//ajax information
'url': "",
'method': "GET",
/*
Copyright 2010 Stephen "Rixius" Middleton
Licensed under the MIT-style License <http://www.opensource.org/licenses/mit-license.html>
usage Style(Object styleRules, object Options)
Options: { //with defaults
makeStyle: true, //if true makes the <style> elment and wraps it around the styles
placeInDOM: false, //if true, if makeStyle is true, then places the elemen ad the of the <head> element
important: false //appends " !important" at the end of each declration, Just in case it's needed;
@AlyxRen
AlyxRen / Interval.js
Created January 17, 2011 09:39
Awesome Interval machiene
var Interval = (function (und){
return function(fn, time, count){
if (time !== time-0) return null;
if (count !== count-0) count = -1;
switch (count){
case -1:
return setInterval(fn, time);
break;
case 0:
return setTimeout(fn, time);
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0]
@AlyxRen
AlyxRen / LICENSE.txt
Created May 20, 2011 19:25 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@AlyxRen
AlyxRen / LICENSE.txt
Created May 20, 2011 19:26 — forked from jed/LICENSE.txt
generate random UUIDs
Copyright (c) 2011 Jed Schmidt, http://jed.is
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: