This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void insertion_sort(int list[], int size) | |
{ | |
int i, j, insertVal; | |
for (i = 1; i < size; i++) { | |
insertVal = list[i]; | |
for (j = i; j > 0 && insertVal < list[j - 1]; j--) { | |
list[j] = list[j - 1]; | |
} | |
list[j] = insertVal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int ** makeGrid(int size, int *startX, int *startY, int *endX, int *endY) | |
{ | |
// allocate memory for the grid | |
int **grid = (int**)malloc(sizeof(int*) * size); | |
int x, y; | |
for (x = 0; x < size; x++) { | |
grid[x] = (int*)malloc(sizeof(int) * size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void quick_sort(int list[], int left, int right) | |
{ | |
if (left < right) { | |
int pivot = (left + right) / 2; // left + (right - left) / 2 is safer to use for large lists | |
pivot = partition(list, left, right, pivot); | |
quick_sort(list, left, pivot - 1); | |
quick_sort(list, pivot + 1, right); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* d8s.js - a simple js date formatter | |
* Usage: | |
* d8s().print('MM-DD-YY hh:mm:ss'); // outputs: 07-21-13 10:25:01 | |
* d8s('2013/7/21' ,'YYYY/M/D').print('DDD of MMMM, YYYY'); // outputs: 21st of July, 2013 | |
* d8s('Sep. 5, 2013 13:30', 'MMM. D, YYYY HH:mm').date(); // returns the Date object with the set date | |
* d8s(new Date(1995,11,17)).print('DD.MM.YYYY'); // outputs: 17.11.1995 | |
*/ | |
window.d8s = window.d8s || (function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open up your atom's init script file and add the following lines, then restart atom. | |
path = require 'path' | |
endLine = (insertNewLine) -> | |
editor = atom.workspace.activePaneItem | |
if path.extname(editor.getPath()) is '.js' | |
editor.getCursors().forEach((cursor) -> | |
editor.moveCursorToEndOfLine() | |
line = cursor.getCurrentBufferLine().trim() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jquery.tablesorter.js - a small table sorter jquery plugin | |
* Usage: | |
* $('table').tablesorter(); | |
* Options: | |
* $('table').tablesorter({ | |
* defaultSort: [0, 1] // initial sort - [<column index>, <1 (ascending) || -1 (descending)>] | |
* }); | |
* Action Triggers: | |
* $('table').trigger('update'); // to update the table when there are changes like addition/removal of <tr>/<td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom.commands.add 'atom-text-editor', | |
'easy-semicolon:end-line': (event) -> | |
editor = @getModel() | |
editor.moveToEndOfLine() | |
editor.insertText(';') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\e[1;34m\]\u@\h\[\e[0m\]:\[\e[1;36m\]\W\[\e[0m\]$ " | |
alias ll="ls -ahlFG" | |
alias rmd="rm -rf" | |
alias fsize="stat -f%z" | |
alias finder="open -a Finder ./" | |
mcd() { mkdir "$1" && cd "$1"; } | |
gitr() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "SampleWebpack", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"webpack": "./node_modules/.bin/webpack", | |
"bundle": "npm run webpack -- -p", | |
"start": "npm run webpack -- -d --watch" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add(...n) { | |
let t = n.reduce((a, b) => a + b); | |
let a = add.bind(0, t); | |
a.valueOf = () => t; | |
return a; | |
} |
OlderNewer