Skip to content

Instantly share code, notes, and snippets.

View ymhuang0808's full-sized avatar
🌊
Experiencing in rough sea

YMHuang ymhuang0808

🌊
Experiencing in rough sea
View GitHub Profile
@gcatlin
gcatlin / gist:1847248
Created February 16, 2012 19:43
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@stephensauceda
stephensauceda / gulpfile.babel.js
Created June 11, 2015 23:45
ES6 Gulpfile Example
/*
* Steps
* 1. Rename your gulpfile.js to gulpfile.babel.js
* 2. Add babel to your package.json (npm install -D babel)
* 3. Start writing ES6 in your gulpfile!
*/
import gulp from 'gulp'; // ES6 imports!
import sass from 'gulp-sass';
@3runoDesign
3runoDesign / Procfile
Last active March 3, 2022 14:09
Deploy Heroku [Laravel 5.2.*]
web: sh app_boot.sh
worker: php artisan queue:listen
@coolaj86
coolaj86 / github-pages-https-lets-encrypt.md
Last active November 16, 2021 22:36
Github Pages: Let's Encrypt!
@JeffreyWay
JeffreyWay / PhotoApiTest.php
Created May 21, 2013 22:37
Testing APIs in Laravel. Thoughts?
<?php
class PhotoApiTest extends TestCase {
public function setUp()
{
parent::setUp();
Route::enableFilters();
@jerbob92
jerbob92 / MyModuleMenuLink.php
Created October 27, 2015 13:31
Drupal 8 Derative Advanced Menu Link Example
@heat
heat / jasmine.matcher.toBeInstanceOf.js
Created September 4, 2012 19:45
Jasmine Matcher instanceof
beforeEach(function() {
this.addMatchers({
toBeInstanceOf: function(expectedInstance) {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
this.message = function() {
return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name;
};
return actual instanceof expectedInstance;
}
@varunachar
varunachar / ANestObject.json
Last active February 25, 2020 01:17
Google Gson TypeAdapterFactory to use with Retrofit when the the object is nested inside another object (Typically an object which contains status code etc) and when the root changes per object like shown below in the sample ANestedObject.json. Then you can use Retrofit normally! Enjoy
// Root is hotel
{
status : "ok",
statusCode : 200,
hotels : [{
name : "Taj Palace",
location : {
lat : 12
lng : 77
<?php
/**
* @file
* Install, update and uninstall functions for my project.
*/
/**
* Implements hook_install().
*
@DavidFrahm
DavidFrahm / httpProviderSpec.js
Last active March 1, 2017 01:21
AngularJS: Unit test for HTTP Provider config
/*
* If we assume that the philosophy of a provider is only configuration then it makes more sense in most
* cases to test that "it" is configured. As the "it" in this case is the resulting service, using
* module to do the configuration and then inject to test that the configuration worked seems to make sense.
* The trick to understanding these tests is to realize that the function passed to module() does not get called until inject() does it's thing. So assigning to a closure variable in the module initialization function ensures that the Provider is defined before control passes to the injected function. Then you're free to interact with the Provider's configuration interface. The technique is a little bit broken in that the Provider has already provided it's Service. But, if you can tolerate that limitation it works.
*
* Most of this I learned from https://github.com/angular/angular.js/issues/2274
*
* There are multiple describe() suites and it() tests, just to help us trace what's going