Skip to content

Instantly share code, notes, and snippets.

View tofuseng's full-sized avatar

t͡ɕ∱ບຮɐດອ² tofuseng

  • 0x91EA74C6B1991B5B
View GitHub Profile
@tofuseng
tofuseng / switching-to-contracting-uk.md
Last active September 9, 2015 06:32
switching-to-contracting-uk

Becoming a contractor programmer in the UK

https://github.com/tadast/switching-to-contracting-uk

After delaying it for more than a year I have finally made the big move from a stable full time job to the dynamic world of contracting. One of the biggest reasons for delaying the move was not knowing the technicalities of getting all the machinery up and running. The main goal of this document is to provide an easily replicable process you can follow to become a contractor. I can not claim it is the best process to follow, but it has worked for me and other people who have advised me. Use my advice on your own responsibility.

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@tofuseng
tofuseng / delete_fav_tweet
Last active September 16, 2015 08:15
Bulk mass destroy twitter favorites using nodejs
/**
* delete_fav_tweet
*
* @class delete_fav_tweet
* @constructor
*/
/**
* Method to delete_fav_tweet
*
@tofuseng
tofuseng / media_type_spoof_detector.rb
Created May 6, 2015 12:00
create an initializer to override Paperclip's classes file_command_content_type_detector.rb and media_type_spoof_detector.rb
module Paperclip
class MediaTypeSpoofDetector
def self.using(file, name)
new(file, name)
end
def initialize(file, name)
@file = file
@name = name
end
@tofuseng
tofuseng / file_command_content_type_detector.rb
Created May 6, 2015 11:59
create an initializer to override Paperclip's classes file_command_content_type_detector.rb and media_type_spoof_detector.rb
module Paperclip
class FileCommandContentTypeDetector
SENSIBLE_DEFAULT = "application/octet-stream"
def initialize(filename)
@filename = filename
end
def detect
type_from_file_command
function BoBo(){this._init.apply(this,arguments)}BoBo.prototype=function(){return{_init:function(e,t){this.imgSrc=e,this.container=document.getElementById(t);if(!this.container){alert("canvas容器不存在!");return}this.shakeAngle=0,this.shakeRange=.45,this.shakeRangeDelay=.995,this.shakeAngleSpeed=.65,this.shakeAngleDelay=.995,this.interval=40,this.controlRects=[]},_getPointRGB:function(e,t){e=Math.floor(e),t=Math.floor(t);var n=this.imageData.data,r=[],s=(t*this.canvasWidth+e)*4;for(i=s;i<s+3;i++)r.push(n[i]);return r},_setRectPointRGB:function(e,t,n,r){t=Math.floor(t),n=Math.floor(n);var i=this.rectImageData[e],s=this.controlRects[e],o=s.width,t=t-s.x,n=n-s.y,u=(n*o+t)*4;i.data[u]=r[0],i.data[u+1]=r[1],i.data[u+2]=r[2],i.data[u+3]=255},_makeRectShake:function(e,t){var n=this.controlRects[e],r=n.width*.5,i=n.height*.5,s={x:n.x+r,y:n.y+i},o=Math.PI*2,u=Math.PI/(2*(r+i));for(var a=0;a<o;a+=u){var f={x:r*Math.cos(a),y:i*Math.sin(a)},l={x:t.x-s.x,y:t.y-s.y},c={x:f.x-l.x,y:f.y-l.y},h=1/Math.max(Math.abs(c.x),Math.abs(c.
@tofuseng
tofuseng / delete-all-favorites
Created April 14, 2015 23:20
Delete all your favorites on twitter
unfavori = setInterval(function(){
$(".Grid[data-component-term='tweet']").each(function(){
$(".Grid[data-component-term='tweet']").find(".ProfileTweet-actionButtonUndo.u-linkClean.js-actionButton.js-actionFavorite.js-tooltip")[0].click();
$(".Grid[data-component-term='tweet']")[0].remove();
})
},500)
kontrol = setInterval(function(){
var tweetsys = $(".Grid[data-component-term='tweet']").length;
if(tweetsys < 50 || tweetsys == 50){
window.scrollTo(0,document.body.scrollBottom);