This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.anothersignintest; | |
import java.io.IOException; | |
import com.google.android.gms.auth.GoogleAuthException; | |
import com.google.android.gms.auth.GoogleAuthUtil; | |
import com.google.android.gms.auth.UserRecoverableAuthException; | |
import com.google.android.gms.common.Scopes; | |
import com.google.android.gms.common.ConnectionResult; | |
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Desktop; | |
import java.net.URI; | |
class BrowseURL | |
{ | |
public static void main(String args[]) throws Exception | |
{ | |
// Create Desktop object | |
Desktop d=Desktop.getDesktop(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
private static Singleton istanza = null; | |
//Il costruttore private impedisce l'istanza di oggetti da parte di classi esterne | |
private Singleton() {} | |
// Metodo della classe impiegato per accedere al Singleton | |
public static synchronized Singleton getSingleton() { | |
if (istanza == null) | |
istanza = new Singleton(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final InternetDomainName topPrivateDomain = InternetDomainName.from(uriHost).topPrivateDomain(); | |
topPrivateDomain.name(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg_dump myDatabase --inserts -a -t table1 -t table2 > backup.sql; | |
pg_dump myDatabase --inserts -a -t seq1 -t seq2 > backupSequences.sql; | |
Parameters descriptions: | |
-a, --data-only dump only the data, not the schema | |
-t, --table=TABLE dump the named table(s) only | |
--inserts dump data as INSERT commands, rather than COPY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function toUnicode($str) { | |
if (!mb_check_encoding($str, 'UTF-8')) { | |
trigger_error('String is not encoded in UTF-8'); | |
return false; | |
} | |
return preg_replace_callback('/./u', function ($m) { | |
//convert the char on UTF-16 because the ord function not work very well on UTF-8 | |
$s = mb_convert_encoding($m[0], 'UCS-2LE', 'UTF-8'); | |
$ord = ord($s); |