Skip to content

Instantly share code, notes, and snippets.

Sam Leung sleungcy

Block or report user

Report or block sleungcy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sleungcy / user.rb
Created Mar 9, 2016
Rails question
View user.rb
class User < ActiveRecord::Base
def test
puts "#{user_name.blank?}" # outputs false
if false
user_name = "this_should_never_run"
puts "#{user_name.blank?}" # outputs true
View browserify-cache.json
"modules": {
"/mnt/myapp/app/assets/javascripts/app/_stream_0.js": {
"source": "\"use strict\";\n\nvar a = require(\"./a.json\");\nvar b = require(\"./b.json\");\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zdHJlYW1fMC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLElBQUksSUFBRSxRQUFRLFVBQVIsQ0FBRjtBQUNKLElBQUksSUFBRSxRQUFRLFVBQVIsQ0FBRiIsImZpbGUiOiJfc3RyZWFtXzAuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgYT1yZXF1aXJlKFwiLi9hLmpzb25cIilcbnZhciBiPXJlcXVpcmUoXCIuL2IuanNvblwiKVxuIl19",
"entry": true,
"file": "/mnt/myapp/app/assets/javascripts/app/_stream_0.js",
"id": "/mnt/myapp/app/assets/javascripts/app/_stream_0.js",
"order": 0,
"deps": {
"./a.json": "/mnt/myapp/app/assets/javascripts/app/a.json",
sleungcy / weird_output_from_browserify.js
Created Mar 11, 2016
multiple module.exports chained together?
View weird_output_from_browserify.js
exports.shr64_lo = shr64_lo;
"name": "elliptic",
"version": "6.2.3",
"description": "EC cryptography",
"main": "lib/elliptic.js",
View gist:c86b87c63bdb85394ae9
16:51 sleungcy: I needed to include the polyfill in the end to get function name to work on ie10
16:51 sleungcy: but shouldn't the transformer have dealt with that already? I don't understand why I would stlil need the polyfill
16:53 loganfsmyth: sleungcy: are you saying it works other browsers but not IE10?
16:53 sleungcy: yes (function x(){}).name isn't supported by IE10
16:54 sleungcy: but i thought the transformer-es2015-function-name is for that purpose?
16:54 ljharb: Torkable: vim can read from ./node_modules/.bin/eslint tho
16:54 sleungcy: or is it for something completely different, I wasn't sure if I am thinking right
16:54 ljharb: sleungcy: loganfsmyth: there's always :-D
16:55 ljharb: that shims it in IE 9 - 11
16:55 loganfsmyth: sleungcy: no, `function-name` converts `var foo = function(){}` into `var foo = function foo(){}` so that the function has a name
sleungcy / colorInConsole.groovy
Created Feb 16, 2019 — forked from crevier/colorInConsole.groovy
How to print color in console in groovy
View colorInConsole.groovy
def fg = 30
def bg = 46
def style = "${(char)27}[$fg;$bg"+"m"
| fg | bg | color |
| 30 | 40 | black |
| 31 | 41 | red |
You can’t perform that action at this time.