Skip to content

Instantly share code, notes, and snippets.

View denniss's full-sized avatar
🏠
Working from home

Dennis Suratna denniss

🏠
Working from home
  • San Francisco
View GitHub Profile
@denniss
denniss / .vimrc
Created January 10, 2021 03:22
dotfiles
inoremap jk <ESC>
"Map leader to space
nnoremap <SPACE> <Nop>
let mapleader = " "
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
namespace :workers do
namespace :clockwork do
desc "Stop clockwork"
task :stop do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, :clockworkd, "-c lib/clockwork.rb --pid-dir=#{cw_pid_dir} --log-dir=#{cw_log_dir} stop"
end
end

The process starts by creating the CSR and the private key:

openssl req -nodes -newkey rsa:2048 -nodes -keyout dotmarks.net.key -out dotmarks.net.csr -subj "/C=GB/ST=London/L=London/O=dotmarks/OU=IT/CN=dotmarks.net"

Generates

  • dotmarks.net.key
  • dotmarks.net.csr
total_passengers = 0, total_male = 0, total_female = 0, total_pclass1 = 0, total_pclass2 = 0, total_plcass3 = 0, total_sibsp0 = 0, total_sibsp1 = 0, total_parch0 = 0, total_parch1 = 0, total_age1 = 0, total_age2 = 0, total_age3 = 0
total_survived = 0, total_male_survived = 0, total_female_survived = 0, total_pclass1_survived = 0, total_pclass2_survived = 0, total_pclass3_survived = 0, total_sibsp0_survived = 0, total_sibsp1_survived = 0, total_parch0_survived = 0, total_parch1_survived = 0, total_age1_survived = 0, total_age2_survived = 0, total_age3_survived = 0
#Comment: Parsing the training data
for each passenger in TRAINING data:
total_passengers++
if passenger.survived?:
total_survived++
@denniss
denniss / cocos2d-portrait-5and6.mm
Created May 20, 2013 23:23
cocos2d protrait for both ios5 and 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
//and
if ([[UIDevice currentDevice].systemVersion floatValue] < 6.0) {
// warning: addSubView doesn't work on iOS6
[window_ addSubview:navController_.view];
@denniss
denniss / cocos2d-dragging.m
Created September 17, 2012 07:11
dragging object in Cocos2d
//Capture touch only when the touch lies within _draggableObject
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint currentLocation = [self convertTouchToNodeSpace:touch];
return CGRectContainsPoint(_draggableObject.boundingBox, currentLocation);
}
//Updates the _draggableObject position as touch moves
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event{
CGPoint location = [touch locationInView:[touch view]];
CGPoint convertedLocation = [[CCDirector sharedDirector] convertToGL:location];