Skip to content

Instantly share code, notes, and snippets.

View versluis's full-sized avatar

Jay Versluis versluis

View GitHub Profile
@mmozeiko
mmozeiko / unitypackage2zip.py
Created February 9, 2019 12:31
Python script that converts .unitypackage file to .zip archive
#!/usr/bin/env python3
import sys
import tarfile
import zipfile
from pathlib import Path
src = sys.argv[1]
dst = Path(src).name + ".zip"
@dartiss
dartiss / functions.php
Created November 15, 2017 18:15
WordPress Plugin to List all Site Cookies
<?php
function get_cookies( $paras = '', $content = '' ) {
if ( strtolower( $paras[ 0 ] ) == 'novalue' ) { $novalue = true; } else { $novalue = false; }
if ( $content == '' ) { $seperator = ' : '; } else { $seperator = $content; }
$cookie = $_COOKIE;
ksort( $cookie );
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active November 3, 2024 22:54
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@Koze
Koze / TextSpeechExample8.m
Last active July 22, 2016 22:40
Text Speech Example in iOS 8
// iOS 8 example
- (void)speechText:(NSString *)text
{
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
utterance.rate = AVSpeechUtteranceMinimumSpeechRate;
utterance.volume = 1;
// initialize voice with language code
AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:[AVSpeechSynthesisVoice currentLanguageCode]];
utterance.voice = voice;
@yanknudtskov
yanknudtskov / allow-unfiltered-admin-uploads.php
Created April 21, 2014 18:10
Allowing Unfiltered WordPress Uploads for Administrators With ALLOW_UNFILTERED_UPLOADS
define( 'ALLOW_UNFILTERED_UPLOADS', true );
@aaronwardle
aaronwardle / sharedButtonCode
Last active December 18, 2015 22:28
UIActivityViewController Example
- (void)shareButtonClicked {
//-- set strings and URLs
NSString *textObject = @"Information that I want to tweet or share";
NSString *urlString = [NSString stringWithFormat:@"http://www.mygreatdomain/%@", _selectedPageString];
NSURL *url = [NSURL URLWithString:urlString];
NSArray *activityItems = [NSArray arrayWithObjects:textObject, url, nil];
//-- initialising the activity view controller
@leovandriel
leovandriel / gist:3923434
Last active October 12, 2015 13:19
An iOS view controller for trying out different UIImage preloading strategies
// ImagePreloadingViewController - An iOS view controller for trying out different
// UIImage preloading strategies. Results for 1 MB png on iPhone 4S:
// - No preload: drawing the image right away (80 ms)
// - Header preload: getting the width (10 ms) and then drawing (100 ms)
// - Data preload: getting the data (110 ms) and then drawing (75 ms)
// - Draw preload: drawing it once (100 ms) and then again (20 ms)
// In short: preload a UIImage by drawing it.
// License: BSD
// Author: Leonard van Driel, 2012
@adamgit
adamgit / .gitignore
Last active November 11, 2024 06:14
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@wesbos
wesbos / is_blog.php
Created September 2, 2011 19:32
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>