Skip to content

Instantly share code, notes, and snippets.

View machuga's full-sized avatar

Matt Machuga machuga

View GitHub Profile
<?php
public function new_badges() {
return array_map( function($level) {
return array(
'title' => $level['end_user_title'] ?: $level['pub_title'],
'description' => $level['end_user_description'] ?: $pub['description'],
'url' => array_reduce($level['urls'], function ($url, $url_o) {
return ! $url && $url_o['is_media_url'] && $url_o['is_for_end_user'] ? $url_o : $url;
}, null),
);
$('#myOptions').click(function(e) {
e.preventDefault();
$('#mappings .mapping:not(.autoMapped) select').each(function() {
$('option:last',$(this)).attr('selected', true);
});
});
:10:00fragrant Hi, How can i get ruby on rails job?
10:00Karpah fragrant: lol
10:00fragrant What is the process to get a job?
10:00Karpah fragrant: apply for one.
10:00fragrant Karpah: Where would i apply? How?
10:01Karpah fragrant: to the place you want to work.
10:01fayimora Karpah: yeah and most people say "use something like devise but if its for educational purposes the roll own your own"
10:01Karpah fayimora: sounds fairenough.
10:01fayimora Karpah: hmmm
10:02Karpah fragrant: don't PM me.
@machuga
machuga / gist:2622285
Created May 6, 2012 13:11
Load Laravel app in PHP 5.4 shell
#In your root directory, run php -a:
# Set your $_SERVER['LARAVEL_ENV'], $_SERVER['CLI']['ENV'] or $_SERVER['CLI']['DB'] here
require 'paths.php';
require path('sys').'core.php';
Laravel\Bundle::start(DEFAULT_BUNDLE);
Laravel\Config::set('database.default', $_SERVER['CLI']['DB']);
require path('sys').'cli/dependencies.php';
@machuga
machuga / gist:2638139
Created May 8, 2012 18:13
console.php
<?php
// In your root directory, run php -a:
// Set your $_SERVER['LARAVEL_ENV'], $_SERVER['CLI']['ENV'] or $_SERVER['CLI']['DB'] here
// $_SERVER['CLI']['DB'] = 'local';
$_SERVER['CLI']['ENV'] = $_SERVER['CLI']['DB'] = 'local';
require 'paths.php';
require path('sys').'core.php';
Laravel\Bundle::start(DEFAULT_BUNDLE);
Laravel\Config::set('database.default', isset($_SERVER['CLI']['DB']) ? $_SERVER['CLI']['DB'] : 'default');
@machuga
machuga / ajax content slider
Created May 9, 2012 13:25
binding click event
$(document).ready(function() {
$('.arrow').live('click', function(event) {
var ec = $('#events-container');
ec.fadeOut();
event.preventDefault();
var url = $(this).attr('href');
$.ajax({
url : url,
dataType : "html",
success : function(data) {
@machuga
machuga / payments.html
Created May 16, 2012 23:46 — forked from glideranderson/payments.html
Horrible rails controller method, need help
[{:active=>"no", :start=>Tue, 15 May 2012 20:42:17 UTC +00:00, :amount=>"10.00", :card_type=>"Visa", :card_number=>"0195"}]
<p>Get this output at the end of my .each</p>
@machuga
machuga / start.php
Created July 2, 2012 00:49
Simplistic Laravel Breadcrumb macro
<?php
HTML::macro('breadcrumbs', function() {
$links = '';
$current = URI::current();
if ($current != '/')
{
return array_reduce(explode('/', URI::current()), function($t,$c) use (&$current, &$links) {
$links = $links ? $links.'/'.$c : $c;
@machuga
machuga / .vimrc
Created July 13, 2012 11:04
Vimrc file 07-13-2012
set nocompatible
set number
set ruler
syntax on
" Set encoding
set encoding=utf-8
" Whitespace stuff
@machuga
machuga / Gemfile
Last active December 14, 2015 17:29
Guard for Jasmine CLI tests
source :rubygems
gem 'guard'
gem 'guard-shell'
gem 'rb-fsevent', :require => false
gem 'terminal-notifier-guard' # This will use OSX native notifications