Skip to content

Instantly share code, notes, and snippets.

@nakhli
nakhli / BaseX.cs
Last active September 26, 2015 03:38
Numeric base convertion in C#, Java and Scala
// <copyright file="BaseX.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2011
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@sinbadsoft.com</email>
@nakhli
nakhli / BenchmarkAtoi.scala
Created July 14, 2011 18:59
Benchmarking two Scala atoi implementations: foldLeft vs random access
// <copyright file="BenchmarkAtoi.scala" company="http://www.javageneration.com">
// Copyright (c) Chaker Nakhli 2011
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@javageneration.com</email>
@nakhli
nakhli / editor.css
Last active October 22, 2019 21:06
Backbone.js tutorial - Part 1 - www.sinbadsoft.com
.shape{
height: 100%;
width: 100%;
}
.circle {
border-radius: 50%/50%;
-moz-border-radius: 50%/50%;
-webkit-border-radius: 50%/50%;
}
.hide {
// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2013
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@sinbadsoft.com</email>
@nakhli
nakhli / .vimrc
Last active August 29, 2015 14:04
.vimrc
"Show trailing whitespaces and tabs
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\|\t\+/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$\|\t\+/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$\|\t\+/
autocmd InsertLeave * match ExtraWhitespace /\s\+$\|\t\+/
autocmd BufWinLeave * call clearmatches()
" Show line numbers
set number
if exists('+colorcolumn')
@nakhli
nakhli / angular_csrf.rb
Last active August 29, 2015 14:08
Fix AngularJS + Rails CSRF protection
ActiveSupport.on_load(:action_controller) do
after_action :set_csrf_cookie_for_angular_js
define_method :set_csrf_cookie_for_angular_js do
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
end
private :set_csrf_cookie_for_angular_js
define_method :verified_request_with_angular_header? do
verified_request_without_angular_header? || form_authenticity_token == request.headers['X-XSRF-Token']
@nakhli
nakhli / latency.txt
Created November 10, 2015 08:18 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@nakhli
nakhli / gist:c5443f7dc3584fc1b50ff8ae3f788de7
Created July 6, 2016 09:37 — forked from shoxty/gist:3990315
Chat log with Oracle Technical Support for Taleo
I have a lot of questions regarding the Taleo Business Edition Web Services API. Can you please put me in
contact with somebody that can help me?
Here are a few of the questions:
1) Is there a way to retrieve a list of all the form fields that are required for a requisition including
any custom fields that may have been added?
2) In what order should I made the calls to your services to properly submit a candidate to a requisition?
3) I am currently able to submit generic details of a candidate and attach it to a requisition but how can
I submit employment history, education, references, certifications and upload a resume? Do you have separate