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 <dirent.h> | |
#include <stdio.h> | |
#include <string.h> | |
#define CURRENT_DIR "." | |
#define PARENT_DIR ".." | |
#define MAX_PATH 1024 | |
void listdir(char *dirname, int level); | |
void printn(char *s, int n); |
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
import 'package:http/http.dart' as http; | |
import 'package:crypto/crypto.dart'; | |
import 'dart:convert'; | |
class Pusher { | |
// Replace -us3 with -YOUR_REGION | |
static String baseUrl = "https://api-us3.pusher.com/apps"; | |
final String appId; | |
final String appKey; |
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
(** [bench work] runs a function [work] and returns the amount of milliseconds | |
it took to finish. Uses [Sys.time] to mark the start and end of execution. *) | |
let bench work = | |
let start_time = Sys.time () in | |
work (); | |
let end_time = Sys.time () in | |
(end_time -. start_time) *. 1000.0 | |
;; | |
(* Let's give it a test run! *) |
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
String titleCase(String input) { | |
return input.splitMapJoin(RegExp(r'(\s+|\[|\(|\/)+'), | |
onMatch: (m) => '${m[0]}', | |
onNonMatch: (word) { | |
if (word.length < 2) return word.toUpperCase(); | |
return word.substring(0, 1).toUpperCase() + word.substring(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
profile = janestreet | |
version = 0.26.1 | |
margin = 80 | |
exp-grouping = preserve |
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
exception RPN_eval | |
type token = | |
| Num of float | |
| Binary of (float -> float -> float) | |
| Unary of (float -> float) | |
let eval_rpn tokens = | |
let rec aux ~stack tokens = | |
match tokens, stack with |
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 Printf | |
(* Example adapted from the book: | |
Head First Design Patterns *) | |
class virtual observer = | |
object | |
method virtual update : unit | |
end |
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
local ls = require("luasnip") | |
local s = ls.snippet | |
local sn = ls.snippet_node | |
local t = ls.text_node | |
local i = ls.insert_node | |
local f = ls.function_node | |
local c = ls.choice_node | |
local d = ls.dynamic_node | |
-- local rep = require("luasnip.extras").rep | |
-- local fmt = require("luasnip.extras.fmt").fmt |
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
const vaporwave = str => | |
str.split('') | |
.map(char => | |
/\S/i.test(char) | |
? String.fromCharCode(char.charCodeAt(0) + 65248) | |
: char) | |
.join('') | |
//!> Corporate Aesthetic 80's Shopping Mall | |
console.log( |
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
RegExp.prototype.scan = function(text) { | |
var result = [], match; | |
while(match = this.exec(text)) { | |
result.push(match); | |
} | |
return result; | |
}; |
NewerOlder