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 | |
$fileName = $_FILES['afile']['name']; | |
$fileType = $_FILES['afile']['type']; | |
$fileContent = file_get_contents($_FILES['afile']['tmp_name']); | |
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent); | |
$json = json_encode(array( | |
'name' => $fileName, | |
'type' => $fileType, | |
'dataUrl' => $dataUrl, |
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
# A class-based template for jQuery plugins in Coffeescript | |
# | |
# $('.target').myPlugin({ paramA: 'not-foo' }); | |
# $('.target').myPlugin('myMethod', 'Hello, world'); | |
# | |
# Check out Alan Hogan's original jQuery plugin template: | |
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
# | |
(($, window) -> |
This file has been truncated, but you can view the full file.
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 ffi = require('ffi'); | |
var | |
int8 = ffi.types.int8, | |
uint8 = ffi.types.uint8, | |
int16 = ffi.types.int16, | |
uint16 = ffi.types.uint16, | |
int32 = ffi.types.int32, | |
uint32 = ffi.types.uint32, | |
int64 = ffi.types.int64, |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
try { | |
$dbh = new PDO('mysql:host=localhost;dbname=mytest', 'root', '123', array( | |
PDO::ATTR_PERSISTENT => true)); | |
$rows = array( | |
array(null, 'def', time()), | |
array(null, 'def', time()), | |
array(null, 'def', time()), |
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
/** | |
* Creates an XPath from a node (currently not used inside this Class (instead FormHTML.prototype.generateName is used) but will be in future); | |
* @param {string=} rootNodeName if absent the root is #document | |
* @return {string} XPath | |
*/ | |
$.fn.getXPath = function(rootNodeName){ | |
//other nodes may have the same XPath but because this function is used to determine the corresponding input name of a data node, index is not included | |
var position, | |
$node = this.first(), | |
nodeName = $node.prop('nodeName'), |
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
/** @jsx React.DOM */ | |
var MyComponent = React.createClass({ | |
render: function() { | |
// Defaults in case the props are undefined. We'll have a solution for this | |
// soon that is less awkward. | |
var perMinute = this.props.perMinute || '-'; | |
var perDay = this.props.perDay || '-'; | |
return ( | |
<div> | |
<h3>Clickouts</h3> |
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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Drawing.Imaging; | |
using System.Runtime.InteropServices; | |
using System.IO; | |
namespace S16.Drawing | |
{ | |
#region DDSImage Class |
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
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |
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
# check if job exists | |
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken | |
# with folder plugin | |
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken | |
# without folder plugin | |
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken | |
# create folder |
OlderNewer