Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Ožana OzzyCzech

View GitHub Profile
@jaywilliams
jaywilliams / array_to_object.php
Created Dec 16, 2009
Convert a multi-dimensional array into a stdClass object. Pass by reference.
View array_to_object.php
<?php
/**
* Convert a multi-dimensional array into a stdClass object.
*
* Example:
* $values = array('hello'=>'world');
*
* // Convert the array to an object
* array_to_object($values);
*
@thsutton
thsutton / normalise-path.php
Created Jan 10, 2011
Normalise paths in PHP
View normalise-path.php
<?php
/**
* Normalise a file path string so that it can be checked safely.
*
* Attempt to avoid invalid encoding bugs by transcoding the path. Then
* remove any unnecessary path components including '.', '..' and ''.
*
* @param $path string
* The path to normalise.
* @param $encoding string
@Marak
Marak / base64.js
Created Feb 8, 2011
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
View base64.js
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
*
*/
var base64 = exports;
base64.encode = function (unencoded) {
@RadekDvorak
RadekDvorak / Lock.php
Created Jul 19, 2011
Hack na FileJournal v Nette
View Lock.php
<?php
/**
* Exclusive lock in memcache
*
* @author Radek Dvořák <radek.dvorak@profimedia.cz>
*/
class Lock
{
/**
@dnaber-de
dnaber-de / editor_plugin.js
Created Jan 22, 2012
Wordpress TinyMCE Popup-Dialog. German Tutorial on http://dnaber.de/p1477
View editor_plugin.js
// js/editor_plugin.js
/**
* an example tinyMCE Plugin
*/
tinymce.create(
'tinymce.plugins.myPlugin',
{
/**
* @param tinymce.Editor editor
* @param string url
@simonbingham
simonbingham / gist:3994802
Created Nov 1, 2012
JavaScript: Using HTML5 local storage and jQuery to persist form data
View gist:3994802
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Local Storage Example</title>
<!-- include Bootstrap CSS for layout -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
@sepehr
sepehr / get_daterange_timestamps.php
Created Aug 27, 2013
PHP: Get corresponding timestamp boundaries of a daterange
View get_daterange_timestamps.php
<?php
/**
* Generates timestamp bounderies for the passed date range name.
*
* @param string $range Date range name.
*
* @return array
*/
function get_daterange_timestamps($range)
View backup-homebrew.sh
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
@kareman
kareman / trash.swift
Last active Apr 14, 2020 — forked from brentdax/trash.swift
Swift 3 script for sending files and folders to the trash, using the SwiftShell framework from https://github.com/kareman/SwiftShell .
View trash.swift
#!/usr/bin/env swiftshell
/*
* Released under the MIT License (MIT), http://opensource.org/licenses/MIT
*/
import SwiftShell
import Dispatch
import Cocoa
You can’t perform that action at this time.