Beating your sleepsort by magnitudes! Takes only SUM(argv) ticks and does not overflow the stack either. Fork the gist if you can reduce the size of ticksort.coffee.
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
def what(): | |
i += 1 | |
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
/* | |
* See comments below for explanation | |
*/ | |
/* profile picture link rewrite */ | |
jQuery.ajax({ | |
url: 'index.php', | |
success: function () { | |
if ($('div.fix-link').length) { | |
//console.log('begin fixing user profile links.'); |
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
/* | |
* gosofunky - demos 3 'functional programming' ways to use functions in go | |
*/ | |
package main | |
import "fmt" | |
/** | |
* Way #1: 函数当作输入(引数)和输出(传出值) |
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
#!/bin/bash | |
#Twitter status update bot by http://360percents.com | |
#Author: Luka Pusic <pusic93@gmail.com> | |
#Modified a little bit by oren | |
#REQUIRED PARAMS | |
twitteremail="your@email.here" | |
password="pizzamonkey" | |
tweet="$*" #must be less than 140 chars | |
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
/** | |
* Implements Towers of Hanoi Game | |
* @see http://en.wikipedia.org/wiki/Towers_of_hanoi | |
*/ | |
main() { | |
// Formats a move to output. | |
String say(String from, String to) => "move $from -> $to"; | |
// Makes a move and recursively triggers next moves, if any. | |
hanoi(int discs, String a, String b, String c) { |
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
# db-remove-error-line.sh | |
# Imports a huge mysqldump (.sql) file by removing a one-line error. | |
# @see http://forums.mysql.com/read.php?103,411576,411576 (Error that inspired this workaround) | |
# @see http://dev.mysql.com/doc/refman/5.1/en/news-5-1-24.html (release notes of MySQL fix) | |
# [or] 2012-05-15 | |
# Config - Replace this number with the number an error occurs on. | |
ERRORLINE='100000' | |
# Names filepaths to use. |
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
<table width="100%" cellspacing="0" cellpadding="5" border="0" bgcolor="#FFFFFF"id="textEdit" style="padding-top: 15px; padding-bottom: 15px; background-color: #ffffff;"> | |
<tbody> | |
<tr> | |
<td style="padding-left: 15px; text-align: center;" valign="top"align="center"> | |
<div> | |
<div style="text-align: left;" align="left"> | |
<div> | |
<div style="text-align: center;" align="center"><span style="font-family: Verdana, Geneva; color: #56aebf; font-size: 16pt;" color="#56aebf" size="5"face="Verdana, Geneva"><b>Community Innovation: Judging and SBANE</b></span></div> | |
<div style="text-align: center;" align="center"><span style="color: #56aebf; font-family: Verdana, Geneva; font-size: 18pt;" color="#56aebf" size="5"face="Verdana, Geneva"><b> </b></span></div> | |
<p style="font-size: 12pt; margin-top: 0px; margin-bottom: 0px;"><span style="font-family: Verdana, Geneva;">After <strong>5,400+</strong> reads of online applications, <strong>150+</stron |
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
<?php | |
/** | |
* Sends a simple email. | |
* [or] Tested on 2012-05-31 using Drupal 7.12 | |
* | |
* Usage: | |
* 1) Paste all the below code into your module or include | |
* 2) Configure the two @FIXME's. | |
* 3) Visit /_custom_simple_mail to get an email. | |
* |
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
<?php | |
if (($handle = fopen($filepath, "r")) == FALSE) { | |
echo ("Error loading CSV file '" . $filepath . "'. Import failed."; | |
return; | |
} | |
echo 'Processing CSV file for import...'; | |
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { | |
$columns = count($data); |
OlderNewer