Skip to content

Instantly share code, notes, and snippets.

View tamagokun's full-sized avatar

Mike Kruk tamagokun

View GitHub Profile
@tamagokun
tamagokun / zshrc
Created January 6, 2012 19:52
happy zsh
# DESCRIPTION:
# A simple zsh configuration that gives you 90% of the useful features that I use everyday.
#
# AUTHOR:
# Geoffrey Grosenbach http://peepcode.com
# RVM
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
@tamagokun
tamagokun / test.php
Created January 12, 2012 21:28
Multiple Inheritance in PHP? Eh?
<?php
class Object
{
public static $mixins = array();
public static function extend($class_name)
{
self::$mixins[$class_name] = array();
$reflection = new ReflectionClass($class_name);
self::$mixins[$class_name]["instance_methods"] = array_map(function($a) { return $a->getName();},$reflection->getMethods());
@tamagokun
tamagokun / test
Created February 19, 2012 22:56
Simple code runtime / templating
<?php
$code = "echo \"Hello, from \$place.\";";
function gogogo($raw)
{
$place = "a function";
$tmp=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile())));
file_put_contents($tmp,"<?php $raw ?>");
require $tmp;
@tamagokun
tamagokun / gist:1872059
Created February 20, 2012 22:48
Generate source for new class based on 2 other classes
<?php
//Lets declare some classes to play with
class Model {
public function model_me()
{
return "I am a model!";
}
}
@tamagokun
tamagokun / serve.sh
Created March 9, 2012 15:15
Easy way to restart thin apps
#!/bin/bash
sock='tmp/thin.sock'
if [ -S $sock ]; then
kill -QUIT `pgrep -f $sock`
fi
bundle exec thin start -e production --socket $sock -d
@tamagokun
tamagokun / reset.css
Created April 9, 2012 18:00
Dead. Simple. Reset.
* {
margin: 0;
padding: 0;
}
html, body {
font: 100%/1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
}
input, textarea, select {
@tamagokun
tamagokun / disqus.css
Created May 9, 2012 02:16
Disqus styles
button,
input[type="button"],
input[type="submit"],
button.dsq-button[type], button.dsq-button-small[type] {
padding: .15em .4em .25em;
background: #f06;
border:1px solid transparent;
color: white;
text-transform: lowercase;
font-weight: bold;
@tamagokun
tamagokun / spec.md
Created June 7, 2012 19:05
Global specification for Composer

What

This is a proposed feature for Composer in which you would be able to add a --global option to manipulate installed packages at a system-wide / user-wide level.

This should not be used for autoloading, but rather just for running any binaries.

Why

Some projects provide utilities to be run via the command line. Like other package managers, these packages should be able to be installed at a global level so the commands can be run as long as you have the bin directory in your PATH.

@tamagokun
tamagokun / generate_site.ps1
Created June 14, 2012 17:06
1337 powershell script
$dnn = "c:\inetpub\wwwroot\ACGME-git"
$site = "c:\inetpub\wwwroot\acgme.mslideas.com"
$prod = @("\\10.180.124.118\acgme")
$stage_host = "acgme.mslideas.com"
$prod_host = "prod.acgme.mslideas.com"
# Fetch all pages and assets
# wget (http://users.ugent.be/~bpuype/wget/)
c:\inetpub\wwwroot\ACGME-git\script\wget.exe --mirror --no-parent --page-requisites --reject "login.aspx*,register.aspx*" --no-host-directories --directory-prefix $site http://acgme.mslideas.com
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;