Skip to content

Instantly share code, notes, and snippets.

View PiiXiieeS's full-sized avatar

Jose Gascon PiiXiieeS

View GitHub Profile
@p01
p01 / LICENSE.txt
Last active May 23, 2024 13:46 — forked from 140bytes/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@fgnass
fgnass / LICENSE.txt
Created September 28, 2011 10:53 — forked from p01/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@motyar
motyar / json_template.html
Created December 15, 2011 09:13
Displaying JSON values with JavaScript : Basics of JSON Template with JavaScript
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Displaying JSON values with JavaScript : Basics of JSON Templating with JavaScript</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
@sindresorhus
sindresorhus / simplexhr.js
Created January 9, 2012 15:19
Simple XMLHttpRequest wrapper
var xhr = function() {
var xhr = new XMLHttpRequest();
return function( method, url, callback ) {
xhr.onreadystatechange = function() {
if ( xhr.readyState === 4 ) {
callback( xhr.responseText );
}
};
xhr.open( method, url );
xhr.send();
var data = [ { lat: -28, lng: -55, count: 38 },
{ lat: 29, lng: 38, count: 2 },
{ lat: 36, lng: 117, count: 2 },
{ lat: -22, lng: -48, count: 511 },
{ lat: 41, lng: 133, count: 1 },
{ lat: 51, lng: 13, count: 88 },
{ lat: -25, lng: 158, count: 1 },
// .....5k lines
{ lat: -18, lng: -44, count: 47 },
{ lat: 30, lng: 35, count: 40 },
@hanksudo
hanksudo / i18n-express-jade-app.js
Created July 14, 2013 12:34
express@3.2.5 + i18n-node@0.4.1 + jade@0.33.0
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path')
@sindresorhus
sindresorhus / get-latest-pic-facebook.js
Created October 28, 2013 13:16
Get latest picture from Facebook user using FQL
var endpoint = 'https://graph.facebook.com/fql';
var accessToken = '';
var userId = '';
var q = 'SELECT caption, src_big FROM photo WHERE aid IN(SELECT aid FROM album WHERE owner = ' + userId + ' ORDER BY modified DESC LIMIT 1) ORDER BY modified DESC LIMIT 1';
var url = endpoint + '?access_token=' + accessToken + '&q=' + q;
@mlegenhausen
mlegenhausen / ds
Created March 5, 2014 11:24
Get directory size via the command line on mac os and linux in a human readable format
#!/bin/sh
find $1 -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}' | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}'
/**
* Simple XML parser
* @param {String} xml
* @return {Object}
*/
function parseXML(xml) {
var beg = -1;
var end = 0;
var tmp = 0;
@cowboy
cowboy / 1-file.txt
Last active May 6, 2024 12:29
Iterate over all lines in a file, handing extra trailing newlines
foo bar
baz
qux
last line (there may or may not be a trailing newline after this line)