Skip to content

Instantly share code, notes, and snippets.

View tucq88's full-sized avatar
🎯
Fake it till you make it. Confidence is more important than knowledge.

Tu Chu tucq88

🎯
Fake it till you make it. Confidence is more important than knowledge.
View GitHub Profile
@famanson
famanson / ember-stuff.md
Last active August 29, 2015 14:25
EmberJS resources (Hanoi Javascript meetup)

EmberJS resources:

  • Main EmberJS website
  • ember-cli - command-line tools for project setup and deployment
  • ember-cli-deploy - lightning-fast deployment of Ember to redis/S3 included in eember-cli. You can find an example of a Redis-backed Flask-based Ember frontend endpoint I wrote here. An example deploy.js file that Esplorio uses can be found here
  • For those interested in Google Map integration, you can check this out (only compatible with Ember 1.13 for now - we skipped the latest version since 2.0 is coming up real soon)
  • For those interested in Ember server-side rendering, you can check out fastboot
  • A list of websites built with Ember can be found here
  • Esplorio
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash && echo "source ~/.git-completion.bash" >> ~/.bash_profile && source ~/.bash_profile
@dwightwatson
dwightwatson / RouteClass.php
Last active June 6, 2016 00:07
Get the controller name and action in Laravel 4 which can be used as a class in your HTML. This solution makes use of the parseCallback() and currentRouteAction() functions, which are handy if you want to devise your own version.
<?php
public function routeClass()
{
$routeArray = Str::parseCallback(Route::currentRouteAction(), null);
if (last($routeArray) != null) {
// Remove 'controller' from the controller name.
$controller = str_replace('Controller', '', class_basename(head($routeArray)));
<!-- Hero CTA -->
<button class="c-button c-button--outline t-red c-hero__button js-hero-button qa-hero-button">Hero CTA</button>
// Button base
.c-button {} 

// Button modifier with structural properties.
// In example: `border: 1px solid transparent; padding: 5px 10px;`
@hoatle
hoatle / tax.js
Last active August 13, 2016 19:19
Vietnamese personal tax function for Google Spreadsheet Scripts
/**
* Calulate the personal tax following Vietnamese laws
*
* Let's check out the spreadsheet in action: https://docs.google.com/spreadsheets/d/1ud_yzaPAIcAICNYO_istpGApJdGSUUNkvx3vEMLrf2c/edit?pref=2&pli=1#gid=0
*
* <= 5m - 5%
* <= 10m - 10%
* <= 18m - 15%
* <= 32m - 20%
* <= 52m - 25%
@freekmurze
freekmurze / Upgrade PHP 5 to 7 on a Forge provisioned server.md
Last active February 20, 2017 04:17
Upgrade PHP 5 to 7 on a Forge provisioned server

sudo add-apt-repository ppa:ondrej/php

sudo apt-get install php7.0

sudo apt-get install php7.0-gd

sudo apt-get install php7.0-mysql

sudo apt-get install php-memcached

@mrhieu
mrhieu / rest.js
Last active March 27, 2017 14:54
AngularJS: factory that adds restful support to any factory
'use strict';
/**
* @ngdoc service
* @name app.services.service:RestService
*
* @description
* The common service to quickly setup other services to expose a restful-like interface
*
* How to use in a factory
@davidhemphill
davidhemphill / post.md
Last active January 28, 2018 17:36
Command Buses and Simple Redirects

I've been busy developing a large application on Laravel. In the middle of this, I've been trying to also be a good PHP developer (oxymoron?) and look into using the Command Bus pattern, specifically using Laravel's implementation. I think I get the idea in theory: Fire a Command, the Handler deals with it, the Command is immutable, and all that. I've looked up tons of tutorials on the subject, and even watched Ross Tuck's talk Models and Service Layers; Hemoglobin and Hobgoblins which mentions the subject.

The one thing these tutorials do not mention is how one might use the data generated in the Handler. For example, say I have a controller method that fires off a command:

// Register the User
public function register(RegisterRequest $request)
{
  $this->dispatch(new CreateRegistrationCommand($request));
}
@jamiehoward
jamiehoward / test-driven-laravel.md
Created July 28, 2016 13:51
Laracon 2016 - Adam Wathan - Test Driven Laravel

Test Driven Laravel - Adam Wathan

@adamwathan

  • Write the test, then write the code to satisfy that test.
  • Write the complete minimum to satisfy the test
  • If the class doesn't exist, only create the class.
  • Always write the tests before beginning the code.
  • Start by specifying the application functions.
@ericlbarnes
ericlbarnes / app.js
Created July 22, 2015 02:18
Example delete request
$(document).ready(function() {
$("button.remove").on('click', function(e){
e.preventDefault();
if ( ! confirm('Are you sure?')) {
return false;
}
var action = $(this).data("action");
var parent = $(this).parent();
$.ajax({
type: 'delete',