Skip to content

Instantly share code, notes, and snippets.

View acidsound's full-sized avatar

LEE JAE HO acidsound

View GitHub Profile
@acidsound
acidsound / server.js
Created February 11, 2014 06:01
Future Example on Meteor (server-side only)
Future = Npm.require('fibers/future');
Meteor.methods({
'future':function() {
console.log('future start:'+Date.now());
var fut = new Future();
Meteor.setTimeout(function() {
console.log('callback end:'+Date.now());
fut.return('yahoo:'+Date.now());
}, 1000);
console.log('future end:'+Date.now());
@acidsound
acidsound / log.js
Last active August 29, 2015 13:56
meteor client/server side logging
Meteor.log = function() {
Meteor.call('log', arguments);
};
Meteor.methods({
"log": function(arg) {
console.log.apply(console, arg);
}
});
@acidsound
acidsound / fakeErwin.coffee
Last active August 29, 2015 13:57
d3 rect drag with link link
@vis = null
Meteor.startup ->
@vis = d3.select("svg")
.attr("width", 960)
.attr("height", 500)
@dragmove= (d,i)->
console.log d.x, d.y
@acidsound
acidsound / fuckNode.js
Created March 19, 2014 13:54
fuckNode.js
Future = require('fibers/future');
fiber = require('fibers');
fiber(function() { /* Meteor는 요게 발라져 있음 */
testFuture = function() {
var fut = new Future();
setTimeout(function() {
fut.return(Date.now());
}, 1000);
return fut.wait();
}
<template name="basic">
{{#with stuff}}
{{#S3 callback="savedURL"}}
<input type="file">
{{/S3}}
{{/with}}
{{#each savedURL}}
<p>SAVED URL: {{url}}</p>
{{/each}}
</template>
@acidsound
acidsound / route.coffee
Created June 24, 2014 06:51
accounts-password + iron-router 를 이용한 로그인+권한 구현
# 계정 생성
# Accounts.createUser({username:'kaka', password:'gogo'});
# Accounts.createUser({username:'admin', password:'admin', profile: {role: 'ADMIN'}});
Router.map ->
@route 'home', path: '/'
@route 'about'
@route 'admin'
@route 'noAuth'
@acidsound
acidsound / .tern-project
Created August 25, 2014 16:00
ternJS+meteor configuration
{
libs: [
browser,
jquery,
underscore
],
loadEagerly: [ ],
dontLoad: [ .meteor ],
"plugins": {
meteor: {}
@acidsound
acidsound / resize.sh
Created February 27, 2015 16:53
Android/iOS Icon Generator
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <image_to_convert.png>" >&2
exit 1
fi
# imagemagick script
convert $1 -resize 57x57 iphone.png
convert $1 -resize 120x120 iphone_2x.png
convert $1 -resize 180x180 iphone_3x.png
@acidsound
acidsound / staticWebserver.lua
Created March 30, 2015 15:34
Static WebServer for Nodemcu - esp8266
srv=net.createServer(net.TCP, 15)
srv:listen(80, function(c)
c:on("receive", function(c, pl)
_, _, method, url, vars = string.find(pl, "([A-Z]+) /([^?]*)%??(.*) HTTP")
print(method..":"..url..":"..vars)
if file.open(url, "r")==nil then
file.open("index.html", "r")
end
c:send(file.read())
file.close()
@acidsound
acidsound / collection.html
Last active August 29, 2015 14:24
목원대채팅 Meteor 예제
<head>
<title>WagleChatt</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
</head>
<body>
<h3>와글챗에 어서오세요.</h3>
{{> hello}}
</body>