Skip to content

Instantly share code, notes, and snippets.

@rizqidjamaluddin
rizqidjamaluddin / gist:a9a88fda81e96d65b4cb
Created May 8, 2014 07:32
Baseline vagrant bootstrap.sh file. PHP5, MySQL, composer, redis, server at 192.168.33.10.xip.io, based on a terrifying combination of other people's scripts
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@SheffieldKevin
SheffieldKevin / main.m
Last active November 26, 2018 18:22
I had far more difficulty getting the generation of gif animations working correctly using ImageIO and Core-Graphics aka Quartz on MacOS/iOS than should have reasonably been expected.
// main.m
// creategif
//
// Created by Kevin Meaney on 21/10/2013.
// I've briefly blogged about it here:
// http://blog.yvs.eu.com/2013/10/creating-gif-animations-using-coreimagequartz
// The following code is all that is all the code needed for a creating a command line tool to generate
// a gif animation from image files.
// The main limitation with this code is that apart from the frame delay time of 0.1 second, every
@Gaya
Gaya / class-symbolic-press.php
Last active June 23, 2021 18:39
Symbolic Press is a helper to help you use your WordPress plugins with Symbolic Links. Read more on my blog: http://www.gayadesign.com/diy/using-wordpress-plugins-as-symbolic-links/
<?php
/**
* Symbolic Press is a helper to help you use your WordPress plugins with Symbolic Links.
*
* Read more about it on:
* @link http://www.gayadesign.com/diy/using-wordpress-plugins-as-symbolic-links/
*/
class Symbolic_Press {
public $plugin_path;
public $plugin_name;
@mohitmamoria
mohitmamoria / index.html
Created October 9, 2013 09:40
AngularJS Newline
<!-- use it like this. Please notice that nohtml filter was used before newlines. -->
<p ng-bind-html-unsafe="post.content | nohtml | newlines"></p>
@emilisto
emilisto / ec2_tags.py
Last active March 15, 2019 17:07
Grain for Salt that exposes all EC2 instance tags in grains['tags'], free for all to use and distribute. Tweet me @svammel if you have questions.
"""
ec2_tags - Exports all EC2 tags in a 'tags' grain
For Salt (http://saltstack.org)
Author: Emil Stenqvist <emsten@gmail.com>
Usage:
1. Put ec2_tags.py in roots/_grains/
@nicolashery
nicolashery / mongoose-paginate.js
Last active January 24, 2018 13:02 — forked from craftgear/mongoose_paginate.coffee
Mongoose Paginate plugin
/* Mongoose Paginate plugin
Forked from:
https://gist.github.com/craftgear/1525918
This snippet is inspired by edwardhotchkiss's mongoose-paginate
(https://github.com/edwardhotchkiss/mongoose-paginate)
and works with any methods like where, desc, populate, etc.
The `paginate` method must be called at the end of method chains.
@dgs700
dgs700 / objectToQueryString.js
Created January 30, 2013 22:39
Javascript object to URL encoded query string converter. Code extracted from jQuery.param() and boiled down to bare metal js. Should handle deep/nested objects and arrays in the same manner as jQuery's ajax functionality.
var objectToQueryString = function (a) {
var prefix, s, add, name, r20, output;
s = [];
r20 = /%20/g;
add = function (key, value) {
// If value is a function, invoke it and return its value
value = ( typeof value == 'function' ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
if (a instanceof Array) {
@holms
holms / mpnml
Created July 19, 2012 23:59
Mysql, Php-fpm, Nginx, mysql-pdo, pear on OSX Mountain Lion
sudo port -v install mysql5-server
# Don't do any post-install instructions
sudo -u _mysql mysql_install_db5
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9)
# do this:
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql
@sfider
sfider / LOOCryptString.h
Last active February 28, 2020 07:46
Objective-C macro for hiding (encrypting) strings in compiled binaries.
//
// LOOCryptString.h
//
// Created by Marcin Swiderski on 6/8/12.
// Copyright (c) 2012 Marcin Swiderski. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
@AngryAnt
AngryAnt / Styles.cs
Created June 29, 2012 12:01
Handy utility functions for creating solid colour textures for GUI use.
// Usage:
m_SideBarTexture = CreateTexture (CreateColor ("#30433C"));
// The goodness:
static Color CreateColor (string hexCode, float alpha = 1.0f)
{
if (hexCode.Length == 7 && hexCode[0] == '#')
{