abemassry 2018-06-04T03:13:25.693Z Like 0 Likes Comments golang package main
import "fmt"
func main() {
fmt.Println("Hello World")
} abemassry 2017-04-26T17:54:04.128Z Like 0 Likes Comments sh for i in `bc <<< "obase = 16 ; $(seq 0 65536)" | tr '\n' ' '`; do printf "$i:"; printf "\u$i"; printf '\n'; done | rs -e | less abemassry 2016-11-11T03:23:21.856Z Like 0 Likes Comments json {"Hi": "😀"} abemassry 2013-01-14T01:51:11.165Z Like 0 Likes Comments javascript var socket = io.connect('http://example.com');
socket.on('list_update', function(data) {
console.log("update client with: " + data);
}); abemassry 2013-01-14T01:45:46.866Z Like 0 Likes Comments javascript io.sockets.emit('list_update', data); abemassry 2013-01-10T15:09:47.955Z Like 0 Likes Comments text Now users can delete their own comments that they have submitted. abemassry 2013-01-09T14:59:28.497Z Like 0 Likes Comments text I've added a delete button on the Edit page, so users can now delete their codestagrams. abemassry 2013-01-07T17:49:07.560Z Like 1 Likes Comments text When users go to a codestagram that they personally submitted there will be an Edit link.
They can then edit the Title, Code, Language, and apply a different filter if they'd like. abemassry 2013-01-07T06:02:14.721Z Like 2 Likes Comments javascript function supports_html5_storage() {
try {
//if it worked then you can write something to local storage
localStorage["works"] = "yes";
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
$(document).ready(function() {
$("#login_button_pressed").click(function(){
//if not false then it means it worked
if (supports_html5_storage() !== false) {
//write key value pairs to local storage
localStorage["code_stored"] = 1;
localStorage["title"] = $("#title").val();
localStorage["lang"] = $("#lang").val();
localStorage["filter"] = $("#filter").val();
localStorage["code"] = editor.getValue();
}
$("#code_holder").val(editor.getValue());
});
});
abemassry 2012-12-31T03:00:03.216Z Like 1 Likes Comments javascript models.articles.find( { $or: [ {title: query}, {body: query}]}).limit(30).sort('-date').exec(function(err, data){
if(err) { throw err; }
res.render('results.jade', {
locals: {
page: 'results',
results: data,
query: query
}
});
}); abemassry 2012-12-31T02:55:32.348Z Like 1 Likes Comments javascript app.get('/404', function(req, res){
if (req.user) {
var username = req.user.username;
}
res.render('404.jade', {
locals: {
page: 'Not Found',
user: username
}
});
});
//last function before end of file
app.use(function(req,res){
res.redirect('/404');
}); abemassry 2012-12-31T02:40:44.814Z Like 0 Likes Comments javascript $(document).ready(function() {
q = urldecode(getQuerystring('q'));
$('#search').val(q);
}); abemassry 2012-12-31T02:38:16.437Z Like 0 Likes Comments jade meta(name="viewport", content="width=device-width, initial-scale=1.0")
link(rel="icon", href="/img/favicon1.png")
link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-responsive.css')
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel="stylesheet", type="text/css", href="/stylesheets/zocial.css")
link(rel="stylesheet", href="/stylesheets/auth-buttons.css")
link(href='http://fonts.googleapis.com/css?family=Pompiere', rel='stylesheet', type='text/css')
//-link(rel='stylesheet', href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css')
//-link(rel='stylesheet', href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-responsive.min.css')
script(src='//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js')
script(src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js")
script(src="/javascripts/jquery.timeago.js") abemassry 2012-12-31T02:34:16.062Z Like 0 Likes Comments jade - each like in code.likes
- i++;
button.btn.like(type="button", id="like_#{code.id}")
i.icon-thumbs-up
| Like
- each comment in code.comments
- j++; abemassry 2012-12-31T02:32:52.492Z Like 0 Likes Comments javascript app.get('/code/:id', function(req, res){
if (req.user) {
var username = req.user.username;
}
//if (app.requireAuth === true && req.loggedIn === false)
//res.redirect('/auth/twitter');
//get the example
models.codes.findById(req.params.id, function(err, data){
if (data) {
models.users.findOne({name: username}, function(err, userdata){
//render the view page
res.render('code.jade', {
locals: {
title: data.title,
page: '',
code: data,
user: username,
userdata: userdata
}
});
});
} else {
res.redirect('/404');
}
});
});
abemassry 2012-12-31T02:32:13.073Z Like 0 Likes Comments javascript app.post('/comment', function(req, res){
if (req.user) {
models.users.findOne({name: req.user.username}, function(err, userdata){
var picture = userdata.photo;
var now = new Date();
code_id = req.param('code_id');
models.codes.findById(code_id, function(err, code){
if (err) return handleError(err);
code.comments.push({user: req.user.username, user_photo: picture, body: req.param('comment'), date_commented: now});
var doc = code.comments[0];
console.log(doc);
code.save(function(err) {
console.log('error check');
if(err) { throw err; }
console.log('saved');
res.redirect('/code/'+code_id);
});
});
});
}
});
abemassry 2012-12-31T02:31:26.293Z Like 0 Likes Comments javascript var Likes = new Schema({
like_id: ObjectId,
name: String,
date_liked: Date,
});
exports.Likes = mongoose.model('Likes', Likes);
var Comments = new Schema({
comment_id: ObjectId,
user: String,
user_photo: String,
body: String,
date_commented: Date,
});
exports.Comments = mongoose.model('Comments', Comments);
var schema = new Schema({
code_id: ObjectId,
body: String,
lang: String,
filter: String,
title: String,
date: Date,
submitted_by: String,
submitted_by_photo: String
, likes: [Likes],
comments: [Comments]
}); abemassry 2012-12-31T02:30:30.584Z Like 0 Likes Comments json {
"dependencies": {
"express": "2.5.8",
"jade": ">= 0.0.1",
"mongodb": ">= 0.9.6-7",
"mongoose": ">= 2.5.10",
"everyauth": ">=0.2.32",
"jsdom": ">=0.2.15",
"request": ">=2.11.4",
"xml2js": ">=0.2.0",
"async": ">=0.1.22",
"now": "0.8.1",
"passport": "0.1.15",
"passport-github": "0.1.3",
"util": "0.4.9"
},
"engines": {
"node": ">= 0.8.x",
"npm": "1.1.x"
}
} abemassry 2012-12-21T01:08:08.776Z Like 0 Likes Comments javascript function supports_html5_storage() {
try {
localStorage["works"] = "yes";
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
$(document).ready(function() {
$("#login_button_pressed").click(function(){
if (supports_html5_storage() !== false) {
localStorage["code_stored"] = 1;
localStorage["title"] = $("#title").val();
localStorage["lang"] = $("#lang").val();
localStorage["filter"] = $("#filter").val();
localStorage["code"] = editor.getValue();
}
$("#code_holder").val(editor.getValue());
});
}); abemassry 2012-12-12T18:02:05.819Z Like 0 Likes Comments jade - each like in code.likes
- i++;
button.btn.like(type="button", id="like_#{code.id}")
i.icon-thumbs-up
| Like
- each comment in code.comments
- j++;