Skip to content

Instantly share code, notes, and snippets.

View preslavrachev's full-sized avatar

Preslav Rachev preslavrachev

View GitHub Profile
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/
#!/bin/sh
# Download Neko
curl -L http://nekovm.org/_media/neko-2.0.0-osx.tar.gz > neko-2.0.0-osx.tar.gz
# Extract and copy files to /usr/lib/neko
@preslavrachev
preslavrachev / UploaderServlet.java
Created May 15, 2013 08:08
Handling an Uploadify file upload with a servlet (thanks to http://stackoverflow.com/a/2273711/1107412)
package com.example;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@preslavrachev
preslavrachev / facebookService.java
Created May 8, 2013 12:37
How to submit a FQL query to Facebook on Android (thanks to http://stackoverflow.com/a/13163261/1107412)
String fqlQuery = "select uid, name, pic_square, is_app_user from user where uid in (select uid2 from friend where uid1 = me())";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
@preslavrachev
preslavrachev / find_friend_app_users.sql
Created May 2, 2013 08:05
Find which friends of yours are using a particular Facebook-connected application. Unlike other approaches, using this FQL query, one will fetch only those among one's friends, who are actually using the application. The application in question depends on the access token being passed in the request
SELECT uid,name,is_app_user FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
@preslavrachev
preslavrachev / test1.js
Last active October 10, 2015 15:38
JavaScript's assignment operation in more detail
var x = 2 // x gets a reference to the value of the scalar 2;
var y = x // also gets a reference to the value of the scalar 2; Please, note that y does not refer to x, but //to the value to which x refers. That will make more sense in the later examples.
x++;
y = ??? x = ??? // x == 3, while y==2, because x was given a new reference to the value of the scalar 3. Since //y points a reference to the value of the scalar 2, and not to x, it keeps the value
@preslavrachev
preslavrachev / .building.txt
Created September 8, 2012 11:18
Executing Objective-C code from Haxe (Using NME's native extensions)
#in the Extension folder:
haxelib run hxcpp Build.xml -Diphoneos #device
#or
haxelib run hxcpp Build.xml -Diphonesim #simulator
#or
class TestClass implements Dynamic { // this is the crucial part
var a:String;
public function new() {
this.p = "test1";
}
}
....
class TestClass {
var a:String;
public function new() {
this.p = "test1";
}
}
....
#include <iostream>
#include "pixel.h"
using namespace std;
typedef int (*FunctionFunc)(); // check that out!!!
void theWrapperFunction(FunctionFunc fnc) {
cout << fnc();
}