Skip to content

Instantly share code, notes, and snippets.

View inez's full-sized avatar
💭
Migrating...

Inez Korczyński inez

💭
Migrating...
View GitHub Profile
@inez
inez / gist:1679950
Created January 26, 2012 00:16
Depth first stack iterator in JavaScript
var data = ["a","b",["b1","b2","b3",["c1","c2"]],"c",["c1","c2"]];
var traverse = function(data, callback) {
var current = [data, 0];
var stack = [current];
while(stack.length > 0) {
if(current[1] >= current[0].length) {
stack.pop();
current = stack[stack.length-1];
continue;
}
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
/*
gcc test.c -lm -o test && ./test
@inez
inez / A.class.php
Created October 19, 2012 04:16
Inconsistency between HipHop Virtual Machine and Zend PHP
<?php
class A {
}
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
/* To compile: gcc -o randomizer randomizer.c
* To run: ./randomizer
*/
int main(void) {
int sranded = 0;
ve.dm.wikiaExample = {};
ve.dm.wikiaExample.createExampleDocument = function ( name, store ) {
return ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.wikiaExample );
};
ve.dm.wikiaExample.domToDataCases = {
'INEZINEZ': {
'html': '<body><figure typeof="mw:Image/Thumb" class="mw-halign-right foobar"><a href="Foo"><img src="Bar" width="1" height="2" resource="FooBar"></a><figcaption>abc</figcaption></figure></body>',
'data': [
function Example() {
}
Example.prototype.getHandlers = function() {
return {
'tokenHandler': this.tokenHandler.bind(this),
'serializerHandler': this.serializerHandler.bind(this)
};
};
ve.dm.WikiaCart = function VeDmWikiaCart() {
// Mixin constructors
ve.EventEmitter.call( this );
this.items = [];
};
/* Inheritance */
ve.mixinClass( ve.dm.WikiaCart, ve.EventEmitter );
/*!
* VisualEditor user interface WikiaMediaInsertDialog class.
*/
/**
* Dialog for inserting MediaWiki media objects.
*
* @class
* @extends ve.ui.MWDialog
*
ParseQuery<ParseUser> query = ParseQuery.getQuery(ParseUser.class);
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> arg0, ParseException arg1) {
for(ParseUser user : arg0) {
Log.d(TAG, user.getObjectId());
com.stuff.stuffapp.models.Message m = new com.stuff.stuffapp.models.Message();
m.setText("HEJ HEJ");
m.setFromUser(ParseUser.getCurrentUser());
m.setToUser(user);
@inez
inez / doit.sh
Created July 17, 2014 21:30
webcam
#!/bin/bash
echo "Let's go...\n"
DATEPART="`TZ=":America/Los_Angeles" date +"%Y-%m-%d_%H:%M"`"
OUTPUTDIR="/var/www/cam/"
echo "DATEPART: ${DATEPART}"
echo "OUTPUTDIR: ${OUTPUTDIR}"
wget http://cal-sailing.appspot.com/cam/restaurant -O ${OUTPUTDIR}restaurant_${DATEPART}:00.jpg
wget http://cal-sailing.appspot.com/cam/dock -O ${OUTPUTDIR}dock_${DATEPART}:00.jpg
wget http://boardsportsschool.com/wp-content/uploads/2010/03/webcam.jpg -O ${OUTPUTDIR}alameda_${DATEPART}:00.jpg
mogrify -quality 65% ${OUTPUTDIR}alameda_${DATEPART}:00.jpg