Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
CodeBrauer / anticacheimg.php
Last active August 29, 2015 13:57
Don't Cache Images - PHP Solution
<!-- This img will be cached. -->
<img src="http://example.com/dynamic_image.png">
<!-- This img will not be cached. -->
<img src="http://example.com/dynamic_image.png?x=<?php echo time(); ?>">
Thats a small little hack to prevent caching images.
@CodeBrauer
CodeBrauer / main.c
Created June 13, 2014 21:35
w7ddpatcher
/*
w7ddpatcher - enable Windows 7 DirectDraw palette compatibility fix for a given
program.
Certain games such as Starcraft 1, Warcraft 2 BNE, Age of Empires, Diablo 1,
and others suffer from a "rainbow glitch", when some other program modifies
global Windows color palette while the game is running, causing some objects to
be rendered with wrong colors. Most often this program is Explorer.exe, so
killing it before starting the game usually fixes the glitch, but it is
annoying to do.
@CodeBrauer
CodeBrauer / cart_helper.php
Last active August 29, 2015 14:04
Some helper functions for CodeIgniter Cart Library. With this functions you can get all ids of your cart and also check if the id is in the cart.
<?php
/* cart helper */
function is_item_in_cart($id) {
return in_array($id, get_cart_item_ids());
}
function get_cart_item_ids() {
$CI =& get_instance();
@CodeBrauer
CodeBrauer / convert_px_to_cm.php
Created July 31, 2014 10:39
Converts px to cm (with DPI) and variable precision
<?php
function get_cm_by_px($px, $dpi = 300, $precision = 2) {
$comma = ','; // if US use '.'
return number_format(2.54 * $pic->exif->size->height / $dpi , $precision, $comma,'') ;
}
@CodeBrauer
CodeBrauer / Gitlab.class.php
Created February 3, 2015 16:15
Super simple gitlab library
<?php
/**
* super simple gitlab api
*/
class Gitlab
{
const API_URL = 'http://gitlab.local/';
const PRIVATE_TOKEN = 'XXXXXXXXXXXXXXXXXXX';
public static function get($method, $param = '', $json_encode = true, $show_error = false) {
@CodeBrauer
CodeBrauer / install-bolt.command
Last active August 29, 2015 14:18
mac os command script to install fastly bolt - just put in your htdocs/public_html and run it.
#!/bin/bash
# installs bolt cms to the path and opens the browser.
# works currently only on Mac OS X
# v0.2 @CodeBrauer
cd "$( dirname "${BASH_SOURCE[0]}" )"
clear
@CodeBrauer
CodeBrauer / cron_db_backup.sh
Last active August 29, 2015 14:18
super simple mysql backup script with mysqldump
#!/bin/bash
cd /_backups
HOST="1.2.3.4"
USER="my_backup_user"
PASS="**************"
DATE_TODAY=$(date +"%Y-%m-%d")
@CodeBrauer
CodeBrauer / 1_split.command
Created April 8, 2015 13:22
split files under mac os x - very simple!
#!/bin/bash
# just edit the path and the file and run it.
FATFILE="/path/to/big_fat_file.zip"
SAVEPATH="path/to/save/split/files/part_" # notice the end is '/part_'
# 3221225472 byte = 3GiB // perfect for FAT32... (main reason to split files..)
SPLITSIZE="3221225472"
@CodeBrauer
CodeBrauer / _html5-video-find-bookmarklet.md
Created April 9, 2015 15:16
finds html5 video sources and display them in little popup. can be used as a bookmarklet!

Create a new bookmark (CMD+D / CTRL+D) and add the code in "bookmark-link.txt" as link (better copyable in RAW-view):

Pure Vanilla JS. No jQuery!

Tested with newest chrome.

*minified with created bookmarklet with *

@CodeBrauer
CodeBrauer / argvargc.c
Last active August 29, 2015 14:19
argv / argc example
#include <stdio.h>
int main (int argc, char *argv[]) {
int count;
printf ("This program was called with \"%s\".\n",argv[0]);
if (argc > 1){
for (count = 1; count < argc; count++) {
printf("argv[%d] = %s\n", count, argv[count]);