Skip to content

Instantly share code, notes, and snippets.

View Critter's full-sized avatar

Critter Critter

View GitHub Profile
@Critter
Critter / .htaccess
Created June 6, 2013 17:23
Redirect all except my IP to subdirectory using .htaccess
# my ip
RewriteCond %{REMOTE_HOST} !^255\.255\.255\.255
# this prevents looping
RewriteCond %{REQUEST_URI} !^/maintenance/?
RewriteCond %{REQUEST_URI} /(.*)$
# the redirect
RewriteRule (.*) /maintenance [R=301,L]
@Critter
Critter / gist:5731290
Created June 7, 2013 18:21
Find base 64 decode in php files
find . -name "*.php" -print0 | xargs -0 grep -i -n "eval(base64_decode(" > output.txt
@Critter
Critter / magical_record.m
Created June 28, 2013 14:09
Save localcontext using Magical Record
[localContext MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) {
if (!success)
{
NSLog(@"Error: %@", [error description]);
}
else
{
NSLog(@"SAVED");
}
}];
@Critter
Critter / prepareForSeque
Created June 29, 2013 03:32
passing an object using a seque
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
{
// Get reference to the destination view controller
YourViewController *vc = [segue destinationViewController];
// Pass any objects to the view controller here, like...
[vc setMyObjectHere:object];
<?php
/*
* replace icons in Social Media Feather with custom icons
* @ref: http://wordpress.org/plugins/social-media-feather/
*/
add_filter('synved_social_skin_image_list', 'custom_social_feather_icons');
function custom_social_feather_icons($image_list) {
@Critter
Critter / wordpress-widget.php
Created July 10, 2014 03:56
Exclude category from recent posts in widget
/**
* Recent_Posts widget w/ category exclude class
* This allows specific Category IDs to be removed from the Sidebar Recent Posts list
*
*/
class WP_Widget_Recent_Posts_Exclude extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") );
parent::__construct('recent-posts', __('Recent Posts with Exclude'), $widget_ops);
@Critter
Critter / pushover.py
Created July 11, 2014 19:33
SABNzbd script to push notifications to pushover
#!/usr/bin/python
import httplib, urllib, sys
message = "Download of " + sys.argv[3] + " "
serverurl = "$sabserver"
print("Converting argument " + sys.argv[7] + " to status.")
if(int(sys.argv[7]) == 0):
message = "Download of " + sys.argv[3] + " has been completed."
Sources
46&2 Beta Repository
http://repo.fortysixandtwo.com/
Alex Zielenski
http://repo.alexzielenski.com/
apt.dba-technologies.combeta
http://apt.dba-technologies.com/beta/
@Critter
Critter / How_to_use.php
Last active August 29, 2015 14:08 — forked from hakre/gist:826061
WP_Query Columns
<?php foreach(new WP_Query_Columns($the_query, 10) as $column_count) : ?>
<ul>
<?php while ($column_count--) : $the_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endforeach; ?>
@Critter
Critter / gist:032a7a35693a63bfe374
Created November 6, 2014 05:36
iphone6 resolution for iphone5
Download Cycript onto your Device.
If you have your computer handy, SSH into it by running "ssh [email protected]" or whatever your IP is and enter your password.
By default it is "alpine" without the quotations but you may have changed it. Once you've SSH'd in, run this
(Make sure to open the preferences app first)
cycript -p Preferences
Then