This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char * buffer; | |
buffer = (char*) malloc (42); | |
// Do something with buffer | |
free (buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gist .line, | |
.gist .line-number { | |
font-size: 12px !important; | |
line-height: 20px !important; | |
margin-bottom: 0px !important; | |
} | |
.gist * { | |
margin-bottom: 0px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.events.MouseEvent; | |
var sUrl:String = "http://<VIDEO_URI>"; | |
var metaObj:Object = new Object(); | |
var connection:NetConnection = new NetConnection(); | |
var stream:NetStream; | |
connection.connect(null); | |
stream = new NetStream(connection); | |
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val transformFormat: Reads[JsObject] = { | |
(__ \ 'situation).json.update(of[JsString].map { | |
case JsString(situation) => JsString(Sanitizer.toMarkDown(situation)) | |
}) andThen | |
(__ \ 'solution).json.update(of[JsString].map { | |
case JsString(solution) => JsString(Sanitizer.toMarkDown(solution)) | |
}) andThen | |
(__ \ 'name).json.update(of[JsString].map { | |
case JsString(raw) => JsString(Sanitizer.toText(raw)) | |
}) andThen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
import _root_.utils.Sanitizer | |
import reactivemongo.bson._ | |
import play.modules.reactivemongo.json.BSONFormats._ | |
import play.api.libs.json._ | |
import play.api.libs.json.Reads._ | |
import play.api.libs.functional.syntax._ | |
import play.api.libs.json.JsString | |
import scala.Some |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for { | |
res <- collection.update(Json.obj("slug" -> idea_slug, "user_id" -> Json.obj("$ne" -> vote.user_id)), | |
Json.obj("$addToSet" -> Json.obj(addType -> vote), | |
"$pull" -> Json.obj(removeType -> Json.obj("user_id" -> vote.user_id)), | |
"$addToSet" -> Json.obj("metrics.attachedUsers" -> vote.user_id)) | |
, getLastError, false) | |
idea <- findOne(Json.obj("slug" -> idea_slug)) | |
} yield { | |
idea | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Connect to mySQL (*blocking*) | |
$link = mysqli_connect("localhost", "user", "password", "test"); | |
// Run a query and store result object (*blocking*) | |
if($result = mysqli_query($link, "SELECT * FROM Person")) { | |
// Fetch data from phps internal buffer into $data | |
$data = mysqli_fetch_all($result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import DiscoverReleaseForm from "./releaseManager/DiscoverReleaseForm"; | |
import EditReleaseForm from "./releaseManager/EditReleaseForm"; | |
class ReleaseManager extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numbers = [12, 22, 45, 13, 66, 1, 100, 1, 210, 10, 11]; | |
var max = 0; | |
for (var i = 0;i < numbers.length; i++){ | |
console.log(`numbers.length is ${numbers.length}, i is ${i}, numbers at position ${i} is ${numbers[i]}`); | |
console.log(`Now we test if ${max} is lower than ${numbers[i]}`); | |
if(max < numbers[i]){ | |
console.log(`I is lower, so now ${numbers[i]} is the new max.`); | |
max = numbers[i]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple userland heapdump generator using v8-profiler | |
* Usage: require('[path_to]/HeapDump').init('datadir') | |
* | |
* @module HeapDump | |
* @type {exports} | |
*/ | |
var fs = require('fs'); | |
var profiler = require('v8-profiler'); |