Skip to content

Instantly share code, notes, and snippets.

View dbergey's full-sized avatar
🙃

Diana Bergey dbergey

🙃
View GitHub Profile

Keybase proof

I hereby claim:

  • I am dbergey on github.
  • I am dbergey (https://keybase.io/dbergey) on keybase.
  • I have a public key ASBfG5XPjljGmWg9kwbljH3cC5_9VUb4cgrlDitDDcJJKwo

To claim this, I am signing this object:

@dbergey
dbergey / gist:2695699
Created May 14, 2012 18:56
don't switch chat tabs when switching to chat app
tell application "System Events"
if (count of (every application process whose name is "iChat")) > 0 then
activate application "iChat"
else
activate application "Adium"
end if
end tell
if (type == 'blah')
var conditionalArea = {
stuff: "nonsense"
};
else {
var conditionalArea = {
fillColor: {
linearGradient: [0, 0, 0, 300],
stops: [
[0, Highcharts.getOptions().colors[0]],
@dbergey
dbergey / gist:1439654
Created December 6, 2011 19:50
Browser-Specific Classes
// add OS-specific classes for targeting a whole set of browser on one OS.
$('html').addClass('browser-os-'+ (
navigator.userAgent.match(/Macintosh/) ? 'macos' :
navigator.userAgent.match(/Windows/) ? 'windows' :
navigator.userAgent.match(/Linux/) ? 'linux' :
'unknown')
)
// now add more general browser classes for targeting all version of any one browser. IE disabled since conditional comments added.
.addClass('browser-'+ (
$.browser.msie ? 'ie' :
<pre><?php
$herp = true;
$derp = false;
echo "$herp\n"; // --> 1
echo "$derp\n"; // --> [NOTHING]
?></pre>
// from: http://forum.jquery.com/topic/jquery-reading-comments-from-the-dom
jQuery.fn.comments = function(location) {
var location = location || "inside";
var comments = [];
this.each(function() {
if (location == "inside") {
var children = this.childNodes
for (var i = 0; i < children.length; i++) {
var child = children[i];
@dbergey
dbergey / gist:898689
Created April 1, 2011 19:17
sneaky spinner JS
document.body.innerHTML += '<style style="display: none;">@-webkit-keyframes spinner { 0%, 45%, 100% { -webkit-transform: rotate(0deg); } 50%, 95% { -webkit-transform: rotate(180deg); } } body { -webkit-animation: spinner 300s infinite; }</style>';
// Math.sum.apply(null, [3, 4, 5, 6]) => 18
Math.sum = function() {
var total = 0, x = 0;
while (x < arguments.length) total += arguments[x++];
return total;
};
// Math.avg.apply(null, [3, 4, 5, 6]) => 4.5
Math.avg = function() {
return Math.sum.apply(null, arguments) / arguments.length;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<select multiple>
<option value="4" selected>four</option>
<option value="5">five</option>
</select>
<div id="result"></div>
<script>
$('#result').html( String($('select').val()) );
@dbergey
dbergey / appify
Created November 12, 2010 17:53 — forked from subtleGradient/appify
#!/usr/bin/env bash
#
# url : https://gist.github.com/672684
# version : 2.0.2
# name : appify
# description : Create the simplest possible mac app from a shell script.
# usage : cat my-script.sh | appify MyApp
# platform : Mac OS X
# author : Thomas Aylott <[email protected]>