Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
What Does The Cat Say?

Yanlin Jiang cncolder

:octocat:
What Does The Cat Say?
View GitHub Profile
@cncolder
cncolder / CloudApp Theater Mode.user.js
Last active May 29, 2021 18:48
UserScript - CloudApp Theater Mode
View CloudApp Theater Mode.user.js
// ==UserScript==
// @name CloudApp Theater Mode
// @namespace http://tampermonkey.net/
// @version 0.4
// @description CloudApp theater mode UI redesign. Maximum size video, and move toolbox buttons into nav bar.
// @author colder
// @homepage https://github.com/cncolder
// @updateURL https://gist.github.com/cncolder/2f223ee6fb4b4cb5fa63bb9d1484d5b5/raw/CloudApp%2520Theater%2520Mode.user.js
// @match https://share.getcloudapp.com/*
// @icon https://public.getcloudapp.com/packs/media/images/cloudapp-favicon-d053fc47958e1b85c892b5de0d7ac93a.png
@cncolder
cncolder / gist:97b0e048ef1b756f25df814faacfd2e7
Last active April 16, 2021 12:05
VSCode Jest run it extension monorepo bin path
View gist:97b0e048ef1b756f25df814faacfd2e7
// VSCode Settings - Jest run it - Jest Path
node -e '[_,f,...a]=process.argv;d=path.dirname(f).replace(/\\/g,"");j=require.resolve("jest",{paths:[d]});b=path.resolve(j,"../../bin/jest.js");child_process.spawnSync(b,[f,...a],{cwd:d,stdio:"inherit"})'
@cncolder
cncolder / .eslintrc.js
Last active September 11, 2020 19:38
A way to hack create-react-app for custom config
View .eslintrc.js
// Put me under ./src
module.exports = {
extends: 'react-app',
rules: {
eqeqeq: 'off'
}
}
View lazy factory girl.rb
# spec/factories.rb
class F
class << self
{:a => :attributes_for, :b => :build, :c => :create, :d => :define, :s => :stub, :* => :sequence, :+ => :next}.each do |k,v|
delegate v, :to => Factory
alias_method k, v
end
end
end
View application.js
//BUGFIX: Chromeframe miss some features.
(function($) {
$.oldAjax = $.ajax;
$.ajax = function(o) {
// I can't detect it by navigator.userAgent. So I set it on server side.
if (navigator.chromeframe) {
// Chromeframe can't send DELETE and PUT verb.
if (o.type == "DELETE") {
o.type = "POST";
View application.html.erb
<!-- Hold it in application.html.erb or ur own default layout. for this example put in navigator. -->
<% if @win_ie_with_chromeframe %>
<script>
navigator.chromeframe = true;
</script>
<% end -%>
View rails.js
// Live is new method in jQuery 1.4+.
$('a[data-confirm]').live('click', function () { ... });
// When user click the link. jQuery will handle it and send a ajax request.
$.ajax({
url: "/users/new",
dataType: "script",
...
});
View user.html.erb
<!-- Rails html5 templete -->
<%= link_to "Add user", new_user_path, :remote => true %>
<!-- Will product -->
<a href="/users/new" data-remote="true">Add user</a>
View Concat my name use ruby magic.rb
# Print "colder"
(_=%!%!<<(?#+?@))&&_%(?#+?@)+_%(?/+?@)+_%(?,+?@)+_%(?$+?@)+_%(?%+?@)+_%(?#+?%+?*)
View gist:410523
<html>
<head>
<title>IE PNG Alpha Fix</title>
<style type="text/css">
img { behavior: url("iepngfix.htc") }
</style>
</head>
<body bgcolor="#000000">
<img src="opacity.png"/>
</body>