Skip to content

Instantly share code, notes, and snippets.

View jgonfer's full-sized avatar
Working on CoinDreams!

Josep Gonzalez jgonfer

Working on CoinDreams!
View GitHub Profile
<?php
+ $rank = 34.2;
$url = "https://discordapp.com/api/webhooks/xxx"; // Censored for privacy
$hookObject = json_encode([
"username" => "Promotion Logs",
"avatar_url" => "https://cdn.discordapp.com/icons/472520717515096078/60cc7dd2864c95a749516d1213359b67.png",
"tts" => false,
"embeds" => [
[
@spalladino
spalladino / falsehoods-that-ethereum-programmers-believe.md
Last active May 20, 2024 21:04
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i

@Mo45
Mo45 / discord.msg.send.php
Last active June 26, 2024 01:57
PHP - Send message to Discord via Webhook
<?php
//=======================================================================================================
// Create new webhook in your Discord channel settings and copy&paste URL
//=======================================================================================================
$webhookurl = "YOUR_WEBHOOK_URL";
//=======================================================================================================
// Compose message. You can use Markdown
// Message Formatting -- https://discordapp.com/developers/docs/reference#message-formatting
@gbitaudeau
gbitaudeau / Int+Extenstion.swift
Created March 3, 2017 09:44
iOS solution to convert large numbers to smaller format. See : http://stackoverflow.com/a/35504720/1661338
extension Int {
func formatUsingAbbrevation () -> String {
let numFormatter = NSNumberFormatter()
typealias Abbrevation = (threshold:Double, divisor:Double, suffix:String)
let abbreviations:[Abbrevation] = [(0, 1, ""),
(1000.0, 1000.0, "K"),
(100_000.0, 1_000_000.0, "M"),
(100_000_000.0, 1_000_000_000.0, "B")]
@minikin
minikin / Iterate.swift
Last active January 24, 2020 22:52
Iterate over object class attributes in Swift
import UIKit
struct User {
var name = ""
var lastName = ""
var nickName = ""
var age = 0
}
var user = User()
@thejakeofink
thejakeofink / ChromeCustomTabsActivity.kt
Created February 19, 2016 15:07
Chrome Custom Tabs example in Kotlin
package com.thejakeofink.chromecustomtabs
import android.content.ComponentName
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.support.customtabs.CustomTabsClient
import android.support.customtabs.CustomTabsIntent
import android.support.customtabs.CustomTabsServiceConnection
import android.support.customtabs.CustomTabsSession
@joepie91
joepie91 / vpn.md
Last active July 17, 2024 14:15
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@chiedo
chiedo / dark-gist-embed-theme.css
Created May 1, 2015 13:57
A Dark gist Embed theme
pre {
padding: 20px;
color: #ffffff;
background: #434343; }
body .gist .line-data, body .gist .file-data, body .gist .line-numbers {
color: #ffffff;
background: #434343; }
body .gist .gist-meta {
color: #ffffff;
@joashp
joashp / PushNotifications.php
Last active June 3, 2024 15:38
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@AliSoftware
AliSoftware / struct_vs_inheritance.swift
Last active March 27, 2024 11:57
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
// http://realm.io/news/andy-matuschak-controlling-complexity/