Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈

Jessica Claire Edwards jsscclr

🐈
  • Sydney, Australia
View GitHub Profile
@jsscclr
jsscclr / rb_ary_sort_bang
Created Jun 17, 2015
rb_ary_sort_bang from array.c
View rb_ary_sort_bang
VALUE
rb_ary_sort_bang(VALUE ary)
{
rb_ary_modify(ary);
assert(!ARY_SHARED_P(ary));
if (RARRAY_LEN(ary) > 1) {
VALUE tmp = ary_make_substitution(ary); /* only ary refers tmp */
struct ary_sort_data data;
long len = RARRAY_LEN(ary);
@jsscclr
jsscclr / array#sort!
Last active Aug 29, 2015
array#sort! example
View array#sort!
a = [ "d", "a", "e", "c", "b" ]
a.sort! #=> ["a", "b", "c", "d", "e"]
a.sort! { |x,y| y <=> x } #=> ["e", "d", "c", "b", "a"]
View juggling_async.js
// Collect the complete content of three URLs and print it to the console.
// Print one line per URL.
// Print out them out in the same order as the URLs are provided to you as command-line arguments.
var http = require('http');
var urls = [];
for (var i = 2; i < process.argv.length; i++) {
urls.push(process.argv[i]);
}
View provided_solution.js
var http = require('http')
var bl = require('bl')
var results = []
var count = 0
function printResults () {
for (var i = 0; i < 3; i++)
console.log(results[i])
}
View init.org

Emacs Configuration File

(defun tangle-init ()
  "If the current buffer is 'init.org' the code-blocks are
   tangled, and the tangled file is compiled."
  (when (equal (buffer-file-name)
View init.el
(defun tangle-init ()
"If the current buffer is 'init.org' the code-blocks are
tangled, and the tangled file is compiled."
(when (equal (buffer-file-name)
(expand-file-name (concat user-emacs-directory "init.org")))
;; Avoid running hooks when tangling.
(let ((prog-mode-hook nil))
(org-babel-tangle)
(byte-compile-file (concat user-emacs-directory "init.el")))))
@jsscclr
jsscclr / australian-postcodes.sql
Created Oct 21, 2015 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
View australian-postcodes.sql
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@jsscclr
jsscclr / sort.rb
Created Dec 16, 2015 — forked from aspyct/sort.rb
Sample implementation of quicksort, mergesort and binary search in ruby
View sort.rb
# Sample implementation of quicksort and mergesort in ruby
# Both algorithm sort in O(n * lg(n)) time
# Quicksort works inplace, where mergesort works in a new array
def quicksort(array, from=0, to=nil)
if to == nil
# Sort the whole array, by default
to = array.count - 1
end
View init.org

Emacs Configuration File

Initialisation

(defun tangle-init ()
  "If the current buffer is 'init.org' the code-blocks are
View init.org

Emacs Configuration File

Initialisation

(defun tangle-init ()
  "If the current buffer is 'init.org' the code-blocks are