Skip to content

Instantly share code, notes, and snippets.

Colder Xihk cncolder

Block or report user

Report or block cncolder

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
@cncolder
cncolder / .eslintrc.js
Last active Aug 19, 2019
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>
View Adobe Air2rc1 drag List item to Trash or RecycleBin.mxml
<s:List dragEnabled="true" dragMoveEnabled="true">
<s:dataProvider>
<s:ArrayCollection>
<fx:Object label="Item one"/>
<fx:Object label="Item two"/>
<fx:Object label="Item three"/>
</s:ArrayCollection>
</s:dataProvider>
</s:List>
View serveradmin change nat settings
# 试着改回正常值
$ sudo serveradmin settings nat:natportmap_interface = "en1"
nat:natportmap_interface = "en1"
$ sudo serveradmin settings nat:interface = "en0"
nat:interface = "en0"
# 等10秒看看servermgrd起来没
$ ps aux | grep servermgrd | grep -v grep
root 7687 0.0 0.2 2577788 38484 ?? Ss 2:20PM 0:03.57 servermgrd -x
You can’t perform that action at this time.