Skip to content

Instantly share code, notes, and snippets.

View ColdSauce's full-sized avatar
💭
work work work work

Stefan Aleksic ColdSauce

💭
work work work work
View GitHub Profile
<style>
#p553 {
position: fixed !important;
position: absolute;
top: 2px;
top: expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop: document.body.scrollTop)+"px");
left: 2px;
width: 100%;
height: 102%;
background-color: #fff;
@ColdSauce
ColdSauce / gist:59074d3d71d30ef68ef5
Last active August 29, 2015 14:08
interview question
boolean areAnagrams(String s1, String s2){
if(s1 == null || s2 == null){
return false;
}
if(s1.isEmpty() || s2.isEmpty()){
return false;
}
if(s1.length() != s2.length()){
return false;
}
SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://192.168.1.2:3000", new ConnectCallback() {
@Override
public void onConnectCompleted(Exception ex, SocketIOClient client) {
if (ex != null) {
ex.printStackTrace();
return;
}
client.setStringCallback(new StringCallback() {
@Override
public void onString(String string) {
@ColdSauce
ColdSauce / gist:f123fdeb52d23ea79160
Created February 1, 2015 22:29
Read file line by line in Java
String line = "";
Bufferedreader br = new BufferedReader(new FileReader(new File("your file location")));
while((line = br.readLine()) != null){
// do stuff with line
}
def draw_path(self,x,y):
top_right = 999999999999999999999999999999999999
top_left = 999999999999999999999999999999999999
top = 999999999999999999999999999999999999
if y == 0:
return
self.writablePixels[y,x] = (255,0,0)
# print str((x,y))

Keybase proof

I hereby claim:

  • I am coldsauce on github.
  • I am stefanaleksic (https://keybase.io/stefanaleksic) on keybase.
  • I have a public key whose fingerprint is 9175 4FB1 9F3E 5342 B59E 5BF1 0B4C 7393 8C1C 3825

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am coldsauce on github.
  • I am stefanaleksic (https://keybase.io/stefanaleksic) on keybase.
  • I have a public key whose fingerprint is CCCF 78B6 10FD 3562 DBA5 4428 374F A74F 4053 07CD

To claim this, I am signing this object:

@ColdSauce
ColdSauce / Bubble.scala
Last active March 13, 2017 01:27
code golf
object Bubble {
val r = scala.util.Random
def getNewBoardIteration(board: Vector[Vector[Boolean]]): Vector[Vector[Boolean]] = {
val allFalse = board.zipWithIndex.map(row =>
row._1.zipWithIndex.filter(col =>
if(((row._2 % 2) + col._2) % 2 == 0)
!col._1
else
false
)
[{"path":"Users/coldsauce/Documents/website","hash":"Qmb3R27q7Ka4ZuNFwJGQtzU9YMEEPeSTe1yctGEDZ9rqFs","size":60},{"path":"Users/coldsauce/Documents","hash":"Qma9ZpSoh4MAHsd8nVFyVcuvJ4fSenbnz3RzTd7DGeh8Fr","size":113},{"path":"Users/coldsauce","hash":"QmXiK1RHuGicXCeumY4pQgYK7M5dXiruGEvw7iojmdBbfU","size":168},{"path":"Users","hash":"QmW7mZHzKG9ZKxCWpCGpoUjDsJtLNTv7hRf5D4kCQW4xxp","size":224},
{"path":"/Users/coldsauce/Documents/website/hacker.png",
"hash":"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn","size":4}]
@ColdSauce
ColdSauce / gist:347d147c17ce9c24482620289702ca47
Created February 25, 2018 20:32
Testing discovery swarm
var swarm = require('discovery-swarm')
var sw = swarm()
sw.listen(8048)
sw.join('dat://85471abf77e6f387e18184fd72d20b8b401add3fb1162cb941b4b868664928c2') // can be any id/name/hash
sw.on('connection', function (connection) {
console.log('found + connected to peer')
})