Skip to content

Instantly share code, notes, and snippets.

View buley's full-sized avatar
🤑

Tay buley

🤑
View GitHub Profile
@wndxlori
wndxlori / settings_view_controller.rb
Created July 4, 2012 17:12
RubyMotion with UILocalNotification
def setup_alarm_notification(for_day, with_switch)
alarm_date = App::Persistence[for_day]
alarm_is_set = App::Persistence[with_switch];
if (alarm_is_set && alarm_date && (alarm_date > Time.now))
local_notification = UILocalNotification.alloc.init
local_notification.fireDate = NSDate.dateWithString( alarm_date.to_s )
local_notification.alertBody = "Time to get up! #{alarm_date.strftime('%H:%M')}"
local_notification.soundName = UILocalNotificationDefaultSoundName
local_notification.applicationIconBadgeNumber = 1
@buley
buley / gist:2604392
Created May 5, 2012 17:59
Highlight dupes in Amazon Cloud Player
var dedupe_view = function() {
var z = jQuery( '.titleCell' ), zlen = z.length, curr, last;
for ( var y = 0; y < 2; y += 1 ) {
for ( var x = 0; x < zlen; x += 1 ) {
zitem = z[ x ];
curr = jQuery( zitem ).attr( 'title' );
if ( curr === "" || curr === null || 'undefined' === typeof curr ) continue;
if ( last === curr ) {
jQuery( zitem ).parent().find( '[actiontypes="remove"]' ).click().parent().click().parent().click();
} else {
@slojo404
slojo404 / index.html
Created April 18, 2012 20:20 — forked from bunkat/index.html
Timeline using d3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Chronological Diagram of Asia</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
.chart {
shape-rendering: crispEdges;
}
@jo-snips
jo-snips / events-conditional-wrappers.php
Last active March 13, 2025 17:33
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@gilmoreorless
gilmoreorless / proxy.js
Created April 1, 2012 23:12
Basic HTTP proxy that introduces random delays to responses, to help test network race conditions
#!/usr/bin/env node
/**
* INSTRUCTIONS
*
* npm install http-proxy
* node proxy.js
*/
var config = {
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@luetkemj
luetkemj / wp-query-ref.php
Last active April 6, 2025 09:15
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@kevinSuttle
kevinSuttle / meta-tags.md
Last active May 1, 2025 21:56 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@EdwardBetts
EdwardBetts / untruncate.py
Created February 24, 2012 20:03
Untruncate using Google Suggest API
from urllib import quote_plus
from lxml import etree
def untruncate(s):
q = s.strip(u' .\u2026')
url = 'http://google.com/complete/search?output=toolbar&q=' + quote_plus(q.encode('latin-1'))
root = etree.parse(url).getroot()
return q + root[0][0].attrib['data'][len(q):] if len(root) else s
def demo():
@Simbul
Simbul / pre-commit
Created February 9, 2012 18:06
Git hook to prevent commits on a staging/production branch
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]