Skip to content

Instantly share code, notes, and snippets.

View flourigh's full-sized avatar
🎯
Focusing

Roberto Monteiro flourigh

🎯
Focusing
View GitHub Profile
@alexzhan
alexzhan / find and delete command
Created November 15, 2010 06:52
linux find command
find command:http://www.oreillynet.com/linux/cmd/cmd.csp?path=f/find
find . -maxdepth 1/2/..../n
%to just find them and printout:
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n'
%delete them, may be modified to use
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n' | xargs rm
http://content.hccfl.edu/pollock/unix/findcmd.htm
@cowboy
cowboy / bad-bad-bad.js
Created October 15, 2011 14:44
Shitty destructors for JavaScript!
function Thing(context, name) {
this.context = context;
this.name = name;
this.init();
this.startTheWorstGarbageCollectorEver();
}
Thing.prototype.startTheWorstGarbageCollectorEver = function() {
var id = setInterval(function() {
if (!this.context[this.name]) {
@davidnunez
davidnunez / gist:1404789
Created November 29, 2011 13:20
list all installed packages in android adb shell
pm list packages -f
@jasonrhodes
jasonrhodes / getProperty.js
Created April 6, 2012 17:40
Get a nested object property by passing a dot notation string as the property name
/**
* A function to take a string written in dot notation style, and use it to
* find a nested object property inside of an object.
*
* Useful in a plugin or module that accepts a JSON array of objects, but
* you want to let the user specify where to find various bits of data
* inside of each custom object instead of forcing a standardized
* property list.
*
* @param String nested A dot notation style parameter reference (ie "urls.small")
@fabiancarlos
fabiancarlos / trim.js
Created June 14, 2012 21:45
Remover todos espaços em branco (JS)
String.prototype.trim = function () {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
};
@willnss
willnss / gist:3246637
Created August 3, 2012 10:52 — forked from leonardofaria/gist:1037052
Gerador de CPF, NIT, CNPJ e CEI válidos
<html>
<head>
<title>Gerador de CPF, CNPJ e NIT Válidos</title>
<script language="javascript">
function gera_random(n) {
var ranNum = Math.round(Math.random()*n);
return ranNum;
}
function mod(dividendo,divisor) {
@DiegoSalazar
DiegoSalazar / validate_credit_card.js
Last active April 24, 2024 12:51
Luhn algorithm in Javascript. Check valid credit card numbers
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@hlashbrooke
hlashbrooke / function.php
Created July 12, 2013 11:18
Simple way to generate a random string/password in PHP
<?php
function random_password( $length = 8 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, $length );
return $password;
}
?>
@13twelve
13twelve / followers.js
Last active October 27, 2020 15:45
Instagram followers js
/*
1:
Install node: http://nodejs.org/download/
2:
Get an access token from Instagram for the user: https://instagram.com/developer/authentication/
3:
Open terminal, cd into the directory where followers.js is.
eg:
@sim642
sim642 / DI.m3u
Created July 5, 2015 12:52
Digitally Imported premium streams
#EXTM3U
#EXTINF:-1,Digitally Imported - Ambient
http://pub1.diforfree.org:8000/di_ambient_hi
#EXTINF:-1,Digitally Imported - Big Room House
http://pub1.diforfree.org:8000/di_bigroomhouse_hi
#EXTINF:-1,Digitally Imported - Breaks
http://pub1.diforfree.org:8000/di_breaks_hi