Skip to content

Instantly share code, notes, and snippets.

View Linnk's full-sized avatar

Ignacio Benavides Linnk

View GitHub Profile
@avafloww
avafloww / PhpJava.java
Last active October 16, 2022 18:50
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@steverichey
steverichey / NeuralPlayground.swift
Created March 17, 2016 03:21
NeuralSwift - A very simple neural network written in Swift.
// see http://lumiverse.io/series/neural-networks-demystified
import Foundation
let startTime = NSDate()
defer {
let endTime = NSDate()
print("Total time \(endTime.timeIntervalSinceDate(startTime))")
}
@carlosascari
carlosascari / rename_function.js
Last active February 19, 2016 06:45
A Hacky way of renaming an existing function
/**
* Renames and existing function.
*
* @private
* @method rename_function
* @param name {String}
* @param fn {Function}
* @return Function
*/
function rename_function(name, fn)
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@simme
simme / gcd.m
Created April 20, 2011 12:21
Loading images async with GCD
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSString *tweetText = [_tweet valueForKey:@"text"];
NSString *userName = [_tweet valueForKeyPath:@"user.name"];
NSString *userDescription = [_tweet valueForKeyPath:@"user.description"];
NSNumber *friends = [_tweet valueForKeyPath:@"user.friends_count"];
NSNumber *followers = [_tweet valueForKeyPath:@"user.followers_count"];
@rjungemann
rjungemann / Communicator.h
Created June 21, 2010 00:45
How to open a TCP socket in Objective-C
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;