Skip to content

Instantly share code, notes, and snippets.

View miraclebg's full-sized avatar
⛰️
Wishing for a hike :)

Martin Kovachev miraclebg

⛰️
Wishing for a hike :)
View GitHub Profile
@dave1010
dave1010 / strip_word_html.php
Created November 12, 2010 13:14
Strip MS Word HTML. From php.net
<?php
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>')
{
mb_regex_encoding('UTF-8');
//replace MS special characters first
$search = array('/&lsquo;/u', '/&rsquo;/u', '/&ldquo;/u', '/&rdquo;/u', '/&mdash;/u');
$replace = array('\'', '\'', '"', '"', '-');
$text = preg_replace($search, $replace, $text);
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears
//in some MS headers, some html entities are encoded and some aren't
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@mateuszwrobel
mateuszwrobel / jquery.plugin_pattern.js
Last active June 17, 2023 13:41
jQuery: plugin pattern
/*
* Project:
* Description:
* Author:
* License:
*/
// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ( $, window, document, undefined ) {
@mauimauer
mauimauer / AA-AndroidWearCrashlytics.md
Last active November 24, 2021 09:58
Forward Wear Crashed to Smartphone/Tablet for reporting via Crashlytics (or other Crash Analytics solutions)

Send uncaught Exceptions from Android Wear to Android

This is a short Gist showing how I transmit any uncaught exceptions happening in the Wearable part of my App to the connected Smartphone/Tablet. This is necessary because Android Wear devices are not directly connected to the Internet themselves.

##Wear

  • WearApp.java
  • AndroidManifest.xml
  • ErrorService.java
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# showing and hiding sheets, resizing preference windows, zooming windows
# float 0 doesn’t work
-ea
-server
-Xms2g
-Xmx4g
-Xss16m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:LargePageSizeInBytes=256m
@bjornson
bjornson / PositionedCropTransformation.java
Last active October 16, 2023 15:42
Custom Glide CropTransformation that allows top/center/bottom left/center/right crop with percentages
package com.extendedvision.futurehistory.images;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
@zafarella
zafarella / intellij VM Options
Created November 14, 2016 04:18
IntelliJ IDEA 2016.2.5 VM options for better response time. (OSX 16GB) -> Help -> Edit custom VM options
-Xms128m
-Xmx1g
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
-XX:+UseCompressedOops
@icanswiftabit
icanswiftabit / bundlerInIOS.MD
Last active April 6, 2024 14:54
How to use bundler with iOS projects

#How to use Bundler with iOS projects

You probably stuck with situation when after finishing for example bundle install && bundle exec pod install Bundler couldn't access gems which he just download. Some of you may think "RVM is the answer!" and yes it is, but what if it is not?

##Don't use macOS's gems. Just DON'T.

  1. Establish that you will don't use macOS's gems and RVM.
  2. Go to your_app_dir
  3. Make sure you have Gemfile if not create one
@pixeline
pixeline / php_upgrade_to_71.sh
Last active March 16, 2023 16:49
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71