Skip to content

Instantly share code, notes, and snippets.

View cncolder's full-sized 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
// ==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
// 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 5, 2023 06:42
A way to hack create-react-app for custom config
// Put me under ./src
module.exports = {
extends: 'react-app',
rules: {
eqeqeq: 'off'
}
}
# 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
//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";
<!-- 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 -%>
// 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",
...
});
<!-- Rails html5 templete -->
<%= link_to "Add user", new_user_path, :remote => true %>
<!-- Will product -->
<a href="/users/new" data-remote="true">Add user</a>
# Print "colder"
(_=%!%!<<(?#+?@))&&_%(?#+?@)+_%(?/+?@)+_%(?,+?@)+_%(?$+?@)+_%(?%+?@)+_%(?#+?%+?*)
<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>