Skip to content

Instantly share code, notes, and snippets.

View Langmans's full-sized avatar

Langmans Langmans

  • Netherlands
  • 04:25 (UTC +02:00)
View GitHub Profile
@Langmans
Langmans / gist:5587866
Created May 15, 2013 22:15
bloodyscreen WTF vararg tables
--This function handles the used game events.
function BS_OnEvent(self, event, ...)
local args = {...};
if (event == "ADDON_LOADED") then
if (args[1] == "BloodyScreen") then
BS_Init();
end
end
if ((event == "UNIT_COMBO_POINTS") and (BS_BloodBehaviour == 1)) then
Thanks to:
http://realityloop.com/blog/2012/07/03/nginx-mariadb-php-aegir-mac-os-x-optional-drush-5-works-mountain-lion
and
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
--Fresh install Mountain Lion.
--Install XCode 4.4.2
--Install Command line utilities via Xcode
--Install Homebrew
@Langmans
Langmans / timestamp.php
Last active August 29, 2015 14:06
Match mysql dates in a string.
<?php
$d = function ($name, $length = '1,2') {
return sprintf('(?<%s>\d{%s}>)', $name, $length);
};
$matches2time = function ($matches, $format = DateTime::W3C) {
$year = $month = $day = $time = $hour = $minute = $second = null;
extract($matches);
$dt = new DateTime();
@Langmans
Langmans / grid.less
Last active November 10, 2015 00:04
simple responsive percentage grid
.grid(
@gutter-width:30px;
@phone-min-width:480px;
@tablet-min-width:768px;
@netbook-min-width:992px;
@desktop-min-width:1230px;
@widescreen-min-width:1440px;
@rtl-classes:true) {
.padded() {
@Langmans
Langmans / index.html
Created November 5, 2014 09:23
A Pen by Ruben Vincenten.
<div class="quarter">
<div class="square">
<div class="content">
<h1>Lorem ipsum</h1>
</div>
</div>
</div>
<div class="quarter">
<div class="square">
<div class="content">
@Langmans
Langmans / composer.json
Last active August 29, 2015 14:09
delegate not working
{
"require": {
"propel/propel": "~2.0@dev"
}
}
@Langmans
Langmans / composer.json
Last active August 29, 2015 14:11
compress_elfinder
{
"repositories": [
{
"type": "package",
"package": {
"name": "studio-42/elfinder",
"version": "2",
"source": {
"url": "https://github.com/Studio-42/elFinder.git",
"type": "git",
$.fn.isCSS = function (properties) {
var property;
for (property in properties) {
if (properties.hasOwnProperty(property)) {
var required_value = properties[property],
actual_value = this.css(property);
//console.log('$.isCSS', property, '=', required_value, required_value != actual_value ? '!=' : '==', actual_value, this[0]);
if (required_value != actual_value) {
return false;
}
@Langmans
Langmans / bootstrap.alerts.close.js
Created January 9, 2015 15:53
auto close bootstrap alerts
(function () {
var timeout = 0;
$('.alert').each(function () {
var
$alert = $(this),
text = $alert.text().replace(/(^\s+|\s+$)/, ''),
num_lines = $alert.height() / parseFloat($alert.css('line-height')),
num_words = text.split(/\s{2,}/).length,
// 120 words per minute and add a second for each line.
seconds = (num_words / 120 * 60) + num_lines;
@Langmans
Langmans / get_var.php
Last active August 29, 2015 14:13
get array value by point sperated index
<?php
function get_var($pointed, $arr, $default = '')
{
$points = explode('.', $pointed);
$var = $arr;
$var_name = '';
while (count($points)) {