Skip to content

Instantly share code, notes, and snippets.

Avatar
🦮
Trottin'.

Antonio Salazar Cardozo Shadowfiend

🦮
Trottin'.
View GitHub Profile
@Shadowfiend
Shadowfiend / Turbomint.sol
Created Feb 16, 2020
Quick and dirty draft contract to allow matching unqualified tBTC Deposit Token holders with accounts willing to front them TBTC and take on ownership of the TDTs (for a fee).
View Turbomint.sol
pragma solidity >=0.4.22 <0.7.0;
interface IERC721 {
function approve(address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function exists(uint256 tokenId) external view returns (bool);
}
interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
View keybase.md

Keybase proof

I hereby claim:

  • I am shadowfiend on github.
  • I am shadowfiend (https://keybase.io/shadowfiend) on keybase.
  • I have a public key whose fingerprint is 917B 2CF5 A4D5 8414 E61B 2B90 AFF2 26F4 A6B6 4797

To claim this, I am signing this object:

View status-line.nu
(function git-branch-for (document)
(let ((directory (((document fileURL) path) stringByDeletingLastPathComponent))
(manager (NSFileManager defaultManager)))
(let (directory-with-git (directory stringByAppendingPathComponent:".git"))
(if (manager directoryExistsNamed:directory-with-git)
(let (previous-directory (manager currentDirectoryPath))
(manager changeCurrentDirectoryPath:directory)
(let (branches ((NSString stringWithShellCommand:"git branch -l")))
(let (current-branch ((/^\* (.*)$/ findInString:branches) groupAtIndex:1))
(manager changeCurrentDirectoryPath:previous-directory)
@Shadowfiend
Shadowfiend / gist:5989309
Last active Dec 19, 2015
Fully functional lift-formality example, with some additions for DateMidnight handling (these will move into lift-formality very soon). Drop this in a Lift project and invoke the Tester.doIt snippet on your form (data-lift="Tester.doIt") and you'll be in bidness.
View gist:5989309
class Tester {
import com.withoutincident.formality._
import Formality._
import Html5Validations._
import org.joda.time.DateMidnight
import org.joda.time.format.DateTimeFormat
private implicit val dateMidnightValueConverter = { value: String =>
val locale = S.locale
@Shadowfiend
Shadowfiend / FormHelpers.scala
Created Feb 26, 2013
ajaxOnSubmit function to use in CssSelectorTransforms to add ajaxSubmit behavior to both button and input submit elements.
View FormHelpers.scala
package net.liftweb.http
import scala.xml._
import net.liftweb.common._
import js._
import net.liftweb.util.Helpers._
object FormHelpers {
/**
@Shadowfiend
Shadowfiend / Layout.scala
Created Nov 5, 2012
Layout snippet that excludes the layout for AJAX requests + JS for retaining functions for AJAX loaded pages.
View Layout.scala
package com.openstudy { package snippet {
import scala.xml._
import net.liftweb.http.S
import net.liftweb.util.Helpers._
class Layout {
def render(xhtml:NodeSeq) = {
if (S.request.map(_.ajax_?) == Full(true)) {
S.skipXmlHeader = true
@Shadowfiend
Shadowfiend / gist:3007331
Created Jun 27, 2012
Code to rehydrate Lift comets.
View gist:3007331
liftComet.lift_sessionLost = function() {
$('body').append(
$('<iframe src="' + location.toString() + '">')
.attr('id', 'reload-iframe')
)
var newWindow = $('#reload-iframe')[0].contentWindow
function preventInitialCometTransaction() {
if (newWindow.liftComet && typeof newWindow.liftComet.lift_cometEntry == 'function') {
liftComet.lift_cometEntry = newWindow.liftComet.lift_cometEntry;
View gist:3005301
/**
* A structural type for an expression that has a getFirst and a getSecond method
* which both return a Symbols.Type.
*/
type TwoPartExpression = {
def getFirst : Symbols.Type
def getSecond : Symbols.Type
}
/**
@Shadowfiend
Shadowfiend / Bundles.scala
Created May 25, 2012
Lift snippet for bundle support in conjunction with Shadowfiend/sbt-resource-management.
View Bundles.scala
package com.openstudy { package snippet {
import scala.xml._
import java.io.InputStreamReader
import net.liftweb.common._
import net.liftweb.http._
import LiftRules._
import net.liftweb.util._
import Helpers._
@Shadowfiend
Shadowfiend / DataHolder.coffee
Created May 8, 2012
DataHolder is used to manage model objects with knockout observable values.
View DataHolder.coffee
# DataHolder handles most Knockout binding situations for properties
# transparently. You can instantiate a DataHolder with a set of attributes
# that are turned into observable properties of the DataHolder.
#
# Attributes passed in that are functions are not wrapped in an observable.
# Additionally, all attributes whose names end in `Fn' are ensured to be
# wrapped in functions and set as is, without an observable.
#
# All attributes are passed through the preprocessAttribute function, which
# can be overridden in child classes. These can be used to do type