Skip to content

Instantly share code, notes, and snippets.

View mrhieu's full-sized avatar

Hieu Pham mrhieu

View GitHub Profile
@mrhieu
mrhieu / terminal.txt
Created January 24, 2019 08:08
List of branches that have been merged to develop and not on master
$ git log origin/master..origin/develop --oneline | grep "Merge pull request" | grep -v "from refuel4/master" | sed "s/.*from [^\/]*\//Branch: /g"
# Example output:
# Branch: fix/4031-batman-hits-a-car
# Branch: feature/3953-iron-man-works-hard
# Branch: fix/3995-global-warming
# Branch: feature/3953-deploy-rocket-to-mars
# Branch: fix/4024-deadpool-got-cancer
@mrhieu
mrhieu / generate-ssh-key.sh
Created July 15, 2018 10:08 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
@mrhieu
mrhieu / Gruntfile.js
Created June 6, 2018 08:55
[Medium] Prevent Annoying Template Caching in AngularJS 1.x
...
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'gitinfo',
'clean:server',
'ngconstant',
@mrhieu
mrhieu / config.js
Created June 1, 2018 12:10 — forked from chodorowicz/config.js
react-storybook samples
/**
* dynamically loading all stories with .stories.js extension
*/
import { configure } from '@kadira/storybook';
require('es6-promise').polyfill();
import 'babel-polyfill';
const stories = require.context('../app/js/components', true, /.stories.js$/);
function loadStories() {
@mrhieu
mrhieu / helper.sass
Last active November 2, 2017 19:23
My helper CSS 1.1.1
/* CSS Helper ver 1.1.1 */
/* FLEX from Google Polymer 0.5.2 */
html
[layout]
&[horizontal], &[vertical]
display: -ms-flexbox
display: -webkit-flex
display: flex
@mrhieu
mrhieu / nvd3_helper.sass
Last active February 7, 2017 08:07
Collection of handy CSS rules for nvd3 chart (D3.js). By adding class name(s), you will have the desired style applied.
.hide-axis-x
.nvd3 .nv-axis.nv-x path
opacity: 0
.hide-axis-y
.nvd3 .nv-axis.nv-y path
opacity: 0
.dashed-userInteractiveGuideLine
.nvd3 .nv-interactiveGuideLine .nv-guideline
stroke-dasharray: 5,3
@mrhieu
mrhieu / slack_delete.rb
Created June 21, 2016 06:40 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@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
@mrhieu
mrhieu / flex.sass
Created October 10, 2014 14:37
Flex layout CSS extracted from Google Polymer 0.4.2
html
[layout]
&[horizontal], &[vertical]
display: -ms-flexbox
display: -webkit-flex
display: flex
&[horizontal][inline], &[vertical][inline]
display: -ms-inline-flexbox
display: -webkit-inline-flex
display: inline-flex
@mrhieu
mrhieu / application.html.erb
Created May 19, 2014 07:15 — forked from collectiveidea/application.html.erb
CSRF token for AJAX POST in Rails 3
<!DOCTYPE html>
<html>
<head>
<title>My Rails App</title>
<%- if protect_against_forgery? -%>
<meta name="authenticity-token" id="authenticity-token" content="<%= form_authenticity_token %>" />
<%- end -%>
<%= javascript_include_tag 'jquery', 'rails' %>
</head>
<body>