Skip to content

Instantly share code, notes, and snippets.

View radiovisual's full-sized avatar
😬
Hello

Michael Wuergler radiovisual

😬
Hello
  • Doodle
  • Switzerland
View GitHub Profile
@radiovisual
radiovisual / copy-from-location.sh
Last active August 29, 2015 13:56
Copy all files from location
#!/bin/bash
# Edit these to point to the proper source
# and destination locations
SOURCE_LOCATION="<SOURCE LOCATION HERE>"
DEST="<DESTINATION LOCATION HERE>"
echo -e "\033[93m------------------------------------"
echo -e "\033[93mCopy files from source location v1.0"
echo -e "\033[93m------------------------------------"
@radiovisual
radiovisual / custom-wordpress-gallery-output.php
Last active September 27, 2022 04:44
Create custom wordpress gallery output
@radiovisual
radiovisual / strip_html.php
Created May 20, 2014 11:04
PHP function to strip all html tags and comments from a string
function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
@radiovisual
radiovisual / box-sizing.css
Created November 9, 2014 22:42
box-sizing recommendation to help fix the annoying box model issues in html/css
/*Ugh. If I say the width is 200px, gosh darn it, it’s gonna be a 200px wide box even if I have 20px of padding.
So as you know, this is NOT how the box model has worked for the past ten years. Anyway, I have a recommendation
for your CSS going forward: (Paul Irish via: http://www.paulirish.com/2012/box-sizing-border-box-ftw/) */
/* apply a natural box layout model to all elements, but allowing components to change */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
@radiovisual
radiovisual / GetAllFonts_iOS.m
Last active January 24, 2016 02:38
Render all your iOS app font names into an NSString that can then be placed within an NSArray
// Create an NSString that can that be copied into an NSArray
// of all the font names available to your Objective-C App
NSMutableString *str = [[NSMutableString alloc] initWithString:@""];
for (NSString *family in [UIFont familyNames]) {
[str appendString:@"//"];
[str appendString:family];
[str appendString:@"\n"];
@radiovisual
radiovisual / CutoutMask.m
Created March 11, 2015 11:42
Make a perfect-circle cutout of any image in Objective-C
// This function will create perfect-circle cutout of any image you supply.
// So if you have a solid black image, the resulting PNG will be a "cutout-out" (transparent)
// circle with a border of solid black. It will return NSData (for use with Parse's PFFile),
// but can be easily modified to return the resulting UIImage (*img)
//
// @param {UIImage} The image you want to "cutout"
// @param {CGSize} The size (width and height) you want the resulting image to be
// return {NSData} the PNGrepresentation of the resulting UIImage
-(NSData *)createCircleCutOutofImage:(UIImage *)image withSize:(CGSize)size {
@radiovisual
radiovisual / CirclePhoto.m
Last active August 29, 2015 14:16
Convert your rectangular image into a perfect circle image with transparent bg.
// @param {UIImage} The rectangle image you want to convert to a round image
// @param {CGSize} The size (width and height) of the resulting round image
// @return {NSData} the PNGRepresentation of the resulting round image
-(NSData *)rectangleImageToTransparentRoundImageFromImage:(UIImage *)image withSize:(CGSize)size {
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
UIImageView *_imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
_imgView.image = image;
@radiovisual
radiovisual / PFLoadingView-Style.m
Last active August 29, 2015 14:18 — forked from chrisvoss/PFLoadingView-Style
Style the default "Loading" view of PFQueryTableViewController the "hard way" as the current API does not provide this feature.
- (void)stylePFLoadingViewTheHardWay
{
UIColor *labelTextColor = [UIColor whiteColor];
UIColor *labelShadowColor = [UIColor darkGrayColor];
UIActivityIndicatorViewStyle activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
// go through all of the subviews until you find a PFLoadingView subclass
for (UIView *subview in self.view.subviews)
{
if ([subview class] == NSClassFromString(@"PFLoadingView"))
@radiovisual
radiovisual / gulp.js
Created July 22, 2015 16:09
Base gulp file for auto-reloading of the browser and auto-min-cat of CSS
var gulp = require('gulp');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var paths = {
css: ['./css/*.css'],
scripts: ['./js/*.js'],
html: ['./*.html']
};
@radiovisual
radiovisual / OpenMobileMenu-DisableBGScroll.js
Last active December 6, 2019 03:31
Open your Mobile Menus and Disable Background Scrolling
$(document).ready(function() {
function closeMobileMenu() {
var mobileContent = $("#mobile_menu_content");
// now `unlock` the body contents and put things back to
// normal before fading out the mobile menu.
var bodyTemp = $('.body_temp');
var scrolltop = Math.abs(bodyTemp.position().top);