Skip to content

Instantly share code, notes, and snippets.

View ajsb85's full-sized avatar
🖼️
Engaging cognitive processors...

Alexander Salas Bastidas ajsb85

🖼️
Engaging cognitive processors...
View GitHub Profile
function stripAccents(str) {
var reAccents = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
var replacements = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
return str.replace(reAccents, function (match) {
return replacements[reAccents.source.indexOf(match)];
});
};
@zhchbin
zhchbin / index.html
Created February 10, 2013 10:55
Node-Webkit API Demo: Window.capturePage
<html>
<body style="background: #333">
<script >
var gui = require('nw.gui');
var win = gui.Window.get();
function takeSnapshot() {
win.capturePage(function(img) {
var popWindow = gui.Window.open('popup.html',
{width: 420, height: 300});
popWindow.on('loaded', function() {
@hersonls
hersonls / less_install.sh
Last active December 13, 2015 17:48
How to install less in DreamHost 1. Install node.js 2. Install npm 3. Install less
#!/bin/sh
git clone git://github.com/ry/node.git
cd node
./configure --prefix=~/.local/usr
make
make install
export npm_config_prefix=~/.local/usr && curl https://npmjs.org/install.sh | sh
@ajsb85
ajsb85 / GPL.md
Created March 10, 2013 00:20 — forked from jnrbsn/GPL.md

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

const { Cc, Ci, Cu } = require('chrome');
const FaviconService = Cc["@mozilla.org/browser/favicon-service;1"].
getService(Ci.nsIFaviconService);
const IO = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
const asyncFavicons = FaviconService.QueryInterface(Ci.mozIAsyncFavicons);
let url = IO.newURI('http://www.mozilla.org', null, null);
// PRINT: URI: null len: 0 data: type:
asyncFavicons.getFaviconDataForPage(url, function (aURI, aDataLen, aData, aMimeType) {
@prettymuchbryce
prettymuchbryce / gist:5542020
Last active April 29, 2021 14:50
hello TypeScript & node.js
/// <reference path="./.node-definitions/node.d.ts" />
/**
* See the node.js TypeScript definition needed for this
* example here: https://github.com/borisyankov/DefinitelyTyped
*/
import Http = module('http');
class MyServer {
{
"ANDROID_VERSION": 1.5,
"APP_VERSION_CODE": 8,
"APP_VERSION_NAME": 1.3,
"AVAILABLE_MEM_SIZE": 181972992,
"BRAND": "generic",
"BUILD": {
"BOARD": "unknown",
"BRAND": "generic",
"DEVICE": "generic",
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active September 22, 2025 03:17
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@KevinGaudin
KevinGaudin / report.php
Last active October 17, 2021 07:00
Simplest PHP ACRA backend
<?php
// Outputs all POST parameters to a text file. The file name is the date_time of the report reception
$fileName = date('Y-m-d_H-i-s').'.txt';
$file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
foreach($_POST as $key => $value) {
$reportLine = $key." = ".$value."\n";
fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
}
fclose($file);
?>
@gavinandresen
gavinandresen / TwoFactorWallet.md
Last active September 2, 2023 13:18
Yubikey/Google Authenticator protected Bitcoin Wallets

Thumbnail sketch: Two-factor (Yubikey or Google Authenticator) protected wallets

Hardware:

Computer. Shared-secret authenticator (Yubikey/Google Authenticator/etc). Server (possibly shared with millions of other users).

Motivating use case setup:

User creates a split (2-of-2 multisig) wallet on the computer and server. Keys must be securely backed up to protect against loss. GUI to be determined, but there will be some type of "Use Authenticator" checkbox specified at setup.