Skip to content

Instantly share code, notes, and snippets.

View javiyt's full-sized avatar
:octocat:
Creating educational repositories

Javi Martín javiyt

:octocat:
Creating educational repositories
View GitHub Profile
@marshall
marshall / activity1.js
Created February 22, 2011 17:24
Native Titanium + Android example code
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
var button = Ti.UI.createButton({title: "Hello world"});
button.addEventListener("click", function(e) {
activity.finish();
});
win.add(button);
});
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@prime31
prime31 / gist:5675017
Last active May 28, 2024 11:37
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@afgomez
afgomez / validate_spanish_id.js
Last active May 5, 2024 12:31
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@todgru
todgru / aws-ec2-redis-cli.md
Created June 12, 2014 23:01
AWS redis-cli on EC2
@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
@isRuslan
isRuslan / index.js
Created October 7, 2014 09:37
Trello developer task
#!/usr/bin/node
/**
* Trello task description: https://trello.com/jobs/developer
*/
/**
* @function hash Create hash from string
* @param {String} str String to hash
* @return {Number} hash
*/
@carlosvillu
carlosvillu / server.js
Created November 6, 2014 10:21
Poc server
var http = require('http'),
ipReg = /\api\/v1\/ip\/(\w+)/,
iplookup = require( './lib/iplookup' );
http.createServer(function (req, res) {
var ip = req.url.match( ipReg );
if( !ip )
{
res.writeHead(404, {'Content-Type': 'text/html'});