Skip to content

Instantly share code, notes, and snippets.

View koreus7's full-sized avatar

Leo Mahon koreus7

  • London
View GitHub Profile
@koreus7
koreus7 / getPWD.cpp
Created February 25, 2018 20:56
Find PWD on OSX
#include <mach-o/dyld.h>
unsigned int bufferSize = 512;
std::vector<char> buffer(bufferSize + 1);
if(_NSGetExecutablePath(&buffer[0], &bufferSize))
{
buffer.resize(bufferSize);
_NSGetExecutablePath(&buffer[0], &bufferSize);
}
std::string s = &buffer[0];
@koreus7
koreus7 / treefun.java
Created August 30, 2017 19:25
Tree Fractal Thing
import java.util.*;
import static java.lang.System.out;
public class TreeNode
{
public List<TreeNode> children;
public TreeNode()
{
jQuery.fn.futureFind = function futureFind(query, callback) {
function startLooking(el, query, initialElement, localEventID) {
var observer;
function stopLooking() {
observer.disconnect();
}
@koreus7
koreus7 / randomarray.js
Last active November 23, 2016 14:39
Random array of fake sentences.
var words = [
'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur',
'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero',
'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut',
'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia',
'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis',
'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros',
'dictum', 'proin', 'accumsan', 'sapien', 'nec', 'massa',
'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus',
'quisque', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus',
IRestResponse response = _client.Execute (request);
response.Content = response.Content.Replace ("[]", "{}");
var formatedResponse = _deserializer.Deserialize<ProfileResponse> (response);
@koreus7
koreus7 / repeat.js
Created August 27, 2015 14:02
How to short this into a while loop?
var lastValue = list[0]
for(var i = 1; i < list.length; i ++ )
{
lastValue = takeTwoValues(list[i],lastValue)
}
f = open("schools.csv", 'r')
l = f.readline();
while l:
l = l[1:-2]
x = repr(l).replace("'","\\\'")[1:-4] + "\'" + ","
if x[0] != "'":
x = "'" + x[1:len(x)]
x = x.replace("\\\\", "\\").replace("\'","\"")
print x
// app.js
define(["require", "exports", "Player"], function (require, exports, player) {
var PhaserDemo = (function () {
function PhaserDemo() {
this.game = new Phaser.Game(800, 600, Phaser.WEBGL, 'content', { preload: this.preload, create: this.create });
}
PhaserDemo.prototype.preload = function () {
this.game.load.image('phaser_run', 'run.png');
};
PhaserDemo.prototype.create = function () {