code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
command:
yum install docker
systemctl enable docker
systemctl start docker
|
dna2github/dna2oldmemory
|
Others/centos-docker-install.sh
|
Shell
|
mit
| 75
|
<section class="thirteen columns">
<h1>Professional Services</h1>
<article>
<p>
<em>KDD: 2019, 2020, 2021</em>
</p>
<p>
<em>AAAI: 2021</em>
</p>
<p>
<em>SysML: 2019</em>
</p>
<p>
<em>DASFAA: 2020, 2021</em>
</p>
<p>
<em>CIKM: 2020</em>
</p>
</article>
</section>
|
bluesjjw/bluesjjw.github.io
|
_includes/services.html
|
HTML
|
mit
| 415
|
; decimal up counter
.model small
.stack
.data
temp dw 00
.code
mov ax,@data
mov ds,ax
mov cx,0063d
mov ax,0000h
lp3:mov temp,ax
mov ah,0fh ; clearing the screen every time
int 10h
mov ah,00h
int 10h
mov ax,temp
call disp
call delay
mov ax,temp
inc ax
loop lp3
mov ah,4ch
int 21h
delay proc
push dx
mov dx,0000fh
up2:dec dx
jnz up2
pop dx
ret
disp proc
aam
add ax,3030h
mov bx,ax
mov dl,ah
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
ret
disp endp
end
|
Amanskywalker/mp-lab
|
lab programs/10a.asm
|
Assembly
|
mit
| 567
|
import { connectModule } from '../../lib/phoneContext';
import DialerPanel from '../../components/DialerPanel';
export default connectModule((phone) => phone.dialerUI)(DialerPanel);
|
ringcentral/ringcentral-js-widget
|
packages/ringcentral-widgets/containers/DialerPage/index.js
|
JavaScript
|
mit
| 183
|
require "gql/version"
require 'active_support/core_ext/string'
require 'logger'
require 'gql/libgraphqlparser/builder'
require 'gql_ext'
require 'gql/core_ext'
require 'gql/field_exp'
require 'gql/base_type'
require 'gql/schema'
require 'gql/parser'
require 'gql/visitor'
require 'gql/operation'
module Gql
module Logger
class << self
attr_accessor :logger
end
def self.debug(*msg)
@logger ||= ::Logger.new(STDOUT)
@logger.debug(msg)
end
end
def self.process(str)
ast = GraphQL::Parser.parse(str)
visitor = Gql::Visitor.new
visitor.accept(ast)
operation = visitor.operation
operation.cal
end
end
|
raykin/gql
|
lib/gql.rb
|
Ruby
|
mit
| 668
|
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>three.js webgl - geometry hierarchy 2</title>
<meta charset="utf-8">
<style type="text/css">
body {
background:#fff;
padding:0;
margin:0;
font-weight: bold;
overflow:hidden;
}
</style>
</head>
<body>
<!-- <script type="text/javascript" src="../build/Three.js"></script> -->
<script type="text/javascript" src="../src/Three.js"></script>
<script type="text/javascript" src="../src/core/Color.js"></script>
<script type="text/javascript" src="../src/core/Vector2.js"></script>
<script type="text/javascript" src="../src/core/Vector3.js"></script>
<script type="text/javascript" src="../src/core/Vector4.js"></script>
<script type="text/javascript" src="../src/core/Ray.js"></script>
<script type="text/javascript" src="../src/core/Rectangle.js"></script>
<script type="text/javascript" src="../src/core/Matrix3.js"></script>
<script type="text/javascript" src="../src/core/Matrix4.js"></script>
<script type="text/javascript" src="../src/core/Object3D.js"></script>
<script type="text/javascript" src="../src/core/Quaternion.js"></script>
<script type="text/javascript" src="../src/core/Vertex.js"></script>
<script type="text/javascript" src="../src/core/Face3.js"></script>
<script type="text/javascript" src="../src/core/Face4.js"></script>
<script type="text/javascript" src="../src/core/UV.js"></script>
<script type="text/javascript" src="../src/core/Geometry.js"></script>
<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
<script type="text/javascript" src="../src/animation/Animation.js"></script>
<script type="text/javascript" src="../src/cameras/Camera.js"></script>
<script type="text/javascript" src="../src/cameras/QuakeCamera.js"></script>
<script type="text/javascript" src="../src/lights/Light.js"></script>
<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
<script type="text/javascript" src="../src/lights/PointLight.js"></script>
<script type="text/javascript" src="../src/materials/Material.js"></script>
<script type="text/javascript" src="../src/materials/Mappings.js"></script>
<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
<script type="text/javascript" src="../src/materials/Texture.js"></script>
<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
<script type="text/javascript" src="../src/objects/Particle.js"></script>
<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
<script type="text/javascript" src="../src/objects/Line.js"></script>
<script type="text/javascript" src="../src/objects/Mesh.js"></script>
<script type="text/javascript" src="../src/objects/Bone.js"></script>
<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
<script type="text/javascript" src="../src/objects/Sound.js"></script>
<script type="text/javascript" src="../src/scenes/Scene.js"></script>
<script type="text/javascript" src="../src/scenes/Fog.js"></script>
<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
<script type="text/javascript" src="../src/renderers/Projector.js"></script>
<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Cube.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Cylinder.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Plane.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Sphere.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Torus.js"></script>
<script type="text/javascript" src="../src/extras/primitives/Icosahedron.js"></script>
<script type="text/javascript" src="../src/extras/primitives/LathedObject.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
<script type="text/javascript">
var container, stats;
var camera, scene, renderer;
var geometry, objects;
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
document.addEventListener( 'mousemove', onDocumentMouseMove, false );
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 500;
scene = new THREE.Scene();
scene.fog = new THREE.Fog( 0xffffff, 1, 10000 );
var geometry = new Cube( 100, 100, 100 );
var material = new THREE.MeshNormalMaterial();
var mesh = new THREE.Mesh( geometry, material );
mesh.position.x = 1000;
objects = [];
objects.push( mesh );
var amount = 200, child, object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.x = 100;
object.addChild( child );
object = child;
objects.push( child );
}
object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.x = - 100;
object.addChild( child );
object = child;
objects.push( child );
}
object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.y = - 100;
object.addChild( child );
object = child;
objects.push( child );
}
object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.y = 100;
object.addChild( child );
object = child;
objects.push( child );
}
object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.z = - 100;
object.addChild( child );
object = child;
objects.push( child );
}
object = mesh;
for ( var i = 0; i < amount; i ++ ) {
child = new THREE.Mesh( geometry, material );
child.position.z = 100;
object.addChild( child );
object = child;
objects.push( child );
}
scene.addObject( mesh );
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.sortObjects = false;
container.appendChild( renderer.domElement );
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
stats.domElement.style.zIndex = 100;
container.appendChild( stats.domElement );
}
function onDocumentMouseMove(event) {
mouseX = ( event.clientX - windowHalfX ) * 10;
mouseY = ( event.clientY - windowHalfY ) * 10;
}
//
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
function render() {
var rx = Math.sin( new Date().getTime() * 0.0007 ) * 0.2,
ry = Math.sin( new Date().getTime() * 0.0003 ) * 0.1,
rz = Math.sin( new Date().getTime() * 0.0002 ) * 0.1;
camera.position.x += ( mouseX - camera.position.x ) * .05;
camera.position.y += ( - mouseY - camera.position.y ) * .05;
for ( var i = 0, l = objects.length; i < l; i ++ ) {
objects[ i ].rotation.x = rx;
objects[ i ].rotation.y = ry;
objects[ i ].rotation.z = rz;
}
renderer.render( scene, camera );
}
</script>
</body>
</html>
|
rwaldron/three.js
|
examples/webgl_geometry_hierarchy2.html
|
HTML
|
mit
| 9,989
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "rClientes_Tipos"
'-------------------------------------------------------------------------------------------'
Partial Class rClientes_Tipos
Inherits vis2Formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0))
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0))
Dim lcParametro1Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1))
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.Append("SELECT Cod_Tip, ")
loComandoSeleccionar.Append("Nom_Tip, ")
loComandoSeleccionar.Append("(Case when status = 'A' then 'Activo' Else 'Inactivo' End) As Status ")
loComandoSeleccionar.Append("FROM Tipos_Clientes ")
loComandoSeleccionar.Append("WHERE Cod_Tip between " & lcParametro0Desde)
loComandoSeleccionar.Append(" And " & lcParametro0Hasta)
loComandoSeleccionar.Append(" And status IN (" & lcParametro1Desde & ")")
'loComandoSeleccionar.Append(" ORDER BY Cod_Tip, Nom_Tip")
loComandoSeleccionar.AppendLine("ORDER BY " & lcOrdenamiento)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodos(loComandoSeleccionar.ToString, "curReportes")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rClientes_Tipos", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrClientes_Tipos.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' MVP: 08/07 08/: Codigo inicial
'-------------------------------------------------------------------------------------------'
' MVP: 11/07/08: Adición de loObjetoReporte para eliminar los archivos temp en Uranus
'-------------------------------------------------------------------------------------------'
' MVP: 01/08/08: Cambios para multi idioma, mensaje de error y clase padre.
'-------------------------------------------------------------------------------------------'
' YJP: 27/04/09: Agregar combo y estandarizacion
'-------------------------------------------------------------------------------------------'
' CMS: 06/05/09: Ordenamiento
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
rClientes_Tipos.aspx.vb
|
Visual Basic
|
mit
| 4,088
|
/** Implementation of a Gain Filter */
public class GainFilter implements Filter<Double> {
/** Class the Gain Filter is made from */
FIRFilter parent;
/** Creates an instance of FIRFilter configured as a GainFilter. Called through a static factory
* @param multiplier the gain constant for the filter
*/
private GainFilter(Double multiplier) {
parent = FIRFilter.makeFIRFilter(new Double[] {multiplier});
}
/** Static factory for GainFilter. The argument must not be null
* @param multiplier the gain for the input values
* @return GainFilter an instance of GainFilter with the requested gain
* @throws IllegalArgumentException thrown when the double is null
*/
public static GainFilter makeGainFilter(Double multiplier) {
if (multiplier == null)
throw new IllegalArgumentException("Parameter list cannot be null");
return new GainFilter(multiplier);
}
/** Filters the given data
* @param data the data to be run through the filter
* @return Double the filtered data
* @throws IllegalArgumentException if data is null
*/
public final Double filter(Double data) {
return parent.filter(data);
}
/** Resets the filter
* @param resetValue the value to calculate the reset values for the input/output histories
* @throws IllegalArgumentException if resetValue is null
*/
public final void reset(Double resetValue) {
parent.reset(resetValue);
}
}
|
BillyBarbaro/Filters
|
GainFilter.java
|
Java
|
mit
| 1,417
|
// Generated by CoffeeScript 1.6.3
(function() {
var Console, FileSystem, colors, _data,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
colors = require('colors');
module.exports = {
Console: Console = (function() {
var MODE_REPL, MODE_RUN;
MODE_REPL = 0;
MODE_RUN = 1;
Console.prototype.buffer = null;
Console.prototype.vars = null;
Console.prototype.paused = false;
Console.prototype.prompt = '';
Console.prototype.altPrompt = '?';
function Console(prompt) {
var stdin;
this.prompt = prompt != null ? prompt : 'katra> ';
this.pause = __bind(this.pause, this);
this.listener = __bind(this.listener, this);
stdin = process.openStdin();
process.stdout.write(this.prompt);
stdin.addListener("data", this.listener);
}
Console.prototype.listener = function($data) {
this.commandHandle($data.toString());
if (this.mode === MODE_REPL) {
if (!this.paused) {
return process.stdout.write(this.prompt);
}
} else {
return process.stdout.write(this.altPrompt);
}
};
Console.prototype.setPrompt = function($prompt) {};
Console.prototype.pause = function($set) {
if (this.paused === $set) {
return;
}
if ((this.paused = $set)) {
return process.stdin.removeListener("data", this.listener);
} else {
process.stdin.addListener("data", this.listener);
if (this.mode === MODE_REPL) {
return process.stdout.write(this.prompt);
} else {
return process.stdout.write(this.altPrompt);
}
}
};
Console.prototype.input = function($prompt, $vars) {
if (this.paused) {
this.pause(false);
}
if ($prompt != null) {
this.print($prompt);
}
this.buffer = [];
this.vars = $vars;
return true;
};
Console.prototype.debug = function($text) {
return process.stdout.write($text.blue + '\n');
};
Console.prototype.hilite = function($text) {
return process.stdout.write($text.yellow + '\n');
};
Console.prototype.print = function($text) {
if ($text == null) {
$text = '';
}
return process.stdout.write($text);
};
Console.prototype.println = function($text) {
if ($text == null) {
$text = '';
}
return process.stdout.write($text + '\n');
};
Console.prototype.clear = function() {};
return Console;
})(),
FileSystem: FileSystem = (function() {
var $root, fs, path;
function FileSystem() {}
fs = require('fs');
path = require('path');
$root = __dirname.slice(0, +__dirname.lastIndexOf('/') + 1 || 9e9);
FileSystem.prototype.setRoot = function($path) {
return $root = $path;
};
FileSystem.prototype.readFile = function($filename, $next) {
return fs.readFile(path.join($root, $filename) + '.bas', function($err, $data) {
if ($err != null) {
return $next($err);
} else {
return $next(null, String($data));
}
});
};
FileSystem.prototype.writeFile = function($filename, $data, $next) {
return fs.writeFile(path.join($root, $filename) + '.bas', "" + $filename + "\n\n" + $data, $next);
};
FileSystem.prototype.deleteFile = function($filename, $next) {
return fs.unlink(path.join($root, $filename) + '.bas', $next);
};
FileSystem.prototype.readDir = function($dir, $next) {
return fs.readdir($root + _data[$dir], function($err, $files) {
var $name;
if ($err != null) {
return $next([]);
} else {
return $next((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = $files.length; _i < _len; _i++) {
$name = $files[_i];
if (/.*\.bas$/.test($name)) {
_results.push($name);
}
}
return _results;
})());
}
});
};
return FileSystem;
})()
};
_data = {
ATARI: 'bas/atari/',
GWBASIC: 'bas/gwbasic/',
GROUP: 'bas/hp2k/group/',
LIBRARY: 'bas/hp2k/system/',
TEST: 'bas/hp2k/test/',
CATALOG: 'bas/hp2k/'
};
}).call(this);
|
darkoverlordofdata/katra
|
template/_assets/rte.node.js
|
JavaScript
|
mit
| 4,595
|
# Runs on Ubuntu Sessions
apt-get install apache2 php5 nano -y
|
mike-bailey/cyberweblessons
|
envsetup.sh
|
Shell
|
mit
| 63
|
define :go_service_user, :user => '', :group => '', :shell => '', :home => '' do
user = params[:user]
group = params[:group]
shell = params[:shell]
home = params[:home]
home = "/home/#{user}" unless !home.to_s.empty?
shell = "/bin/bash" unless !shell.to_s.empty?
group group do
not_if { group == 'root' }
end
user user do
not_if { user == 'root' }
comment "created by chef user"
gid group
home home
supports :manage_home => true
system true
shell shell
end
end
|
gotchef/go-service
|
definitions/go_service_user.rb
|
Ruby
|
mit
| 496
|
<?php /* Smarty version Smarty-3.1.11, created on 2013-03-23 17:42:08
compiled from "/var/www/hermes.sztaki.hu/hermes/moduls/templates/default/MainSemantic.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1660047115514ca473affef5-75475272%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'file_dependency' =>
array (
'93e600525c56d3a71d8a42aa24731b4515ed6127' =>
array (
0 => '/var/www/hermes.sztaki.hu/hermes/moduls/templates/default/MainSemantic.tpl',
1 => 1364056874,
2 => 'file',
),
),
'nocache_hash' => '1660047115514ca473affef5-75475272',
'function' =>
array (
),
'version' => 'Smarty-3.1.11',
'unifunc' => 'content_514ca473b00a03_69782693',
'variables' =>
array (
'ownbundles' => 0,
'p' => 0,
'qroupbundles' => 0,
'ConfigDir' => 0,
),
'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_514ca473b00a03_69782693')) {function content_514ca473b00a03_69782693($_smarty_tpl) {?><div class="span3" align="center" style="padding: 10px;">
<div style="border-bottom: 2px dashed #ddd; padding: 10px;">
<div class="input-prepend">
<span class="add-on">Selected bundle:</span> <span
class="uneditable-input input-small"
id="semanticbundle-edit-current"><?php echo $_smarty_tpl->tpl_vars['ownbundles']->value[0]['name'];?>
</span>
</div>
<input type="hidden" id="semanticbundle-edit-current-val" value="<?php echo $_smarty_tpl->tpl_vars['ownbundles']->value[0]['id'];?>
">
</div>
<div style="border-bottom: 2px dashed #ddd; padding: 10px;">
<input type="button" class="btn btn-primary" href="#addBundleModal"
data-toggle="modal" value="Add own semantic bundle" />
<br />
<div>
Choose own semantic bundle to edit: <select class="input-medium"
id="semanticbundle-edit-selector-own"> <?php $_smarty_tpl->tpl_vars['p'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['p']->_loop = false;
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
$_from = $_smarty_tpl->tpl_vars['ownbundles']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['p']->key => $_smarty_tpl->tpl_vars['p']->value){
$_smarty_tpl->tpl_vars['p']->_loop = true;
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['p']->key;
?>
<option value="<?php echo $_smarty_tpl->tpl_vars['p']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['p']->value['name'];?>
</option> <?php } ?>
</select>
</div>
</div>
<span class="label label-info">OR</span>
<div style="border-bottom: 2px dashed #ddd; padding: 10px;">
<input type="button" class="btn btn-primary"
onClick="addGroupSemanticBundle()" value="Add group semantic bundle" />
<div>
Choose group semantic bundle to edit: <select class="input-medium"
id="semanticbundle-edit-selector-group"> <?php $_smarty_tpl->tpl_vars['p'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['p']->_loop = false;
$_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
$_from = $_smarty_tpl->tpl_vars['qroupbundles']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['p']->key => $_smarty_tpl->tpl_vars['p']->value){
$_smarty_tpl->tpl_vars['p']->_loop = true;
$_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['p']->key;
?>
<option value="<?php echo $_smarty_tpl->tpl_vars['p']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['p']->value['name'];?>
</option> <?php } ?>
</select>
</div>
</div>
</div>
<div class="span12" style="border-left: 2px dashed #ddd; padding: 10px;"
id="semantic-bundle-view">
<?php echo $_smarty_tpl->getSubTemplate (($_smarty_tpl->tpl_vars['ConfigDir']->value).("/moduls/templates/default/SemanticTree.tpl"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
<script>
treeViewAjaxRefresh();
</script>
</div>
<div class="clearfix"></div>
<div id="addBundleModal" class="modal hide fade"><?php echo $_smarty_tpl->getSubTemplate (($_smarty_tpl->tpl_vars['ConfigDir']->value).("/moduls/templates/default/SemanticBundleAdd.tpl"), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
</div>
<?php }} ?>
|
ttoth/thesis
|
WebAlkalmazas/hermes-web/libs/smarty/templates_c/93e600525c56d3a71d8a42aa24731b4515ed6127.file.MainSemantic.tpl.php
|
PHP
|
mit
| 4,318
|
from neo.Core.UIntBase import UIntBase
class UInt256(UIntBase):
def __init__(self, data=None):
super(UInt256, self).__init__(num_bytes=32, data=data)
@staticmethod
def ParseString(value):
"""
Parse the input str `value` into UInt256
Raises:
ValueError: if the input `value` length (after '0x' if present) != 64
"""
if value[0:2] == '0x':
value = value[2:]
if not len(value) == 64:
raise ValueError(f"Invalid UInt256 input: {len(value)} chars != 64 chars")
reversed_data = bytearray.fromhex(value)
reversed_data.reverse()
return UInt256(data=reversed_data)
|
hal0x2328/neo-python
|
neo/Core/UInt256.py
|
Python
|
mit
| 688
|
Phalcon\Ext\Mailer
==============
Mailer wrapper over SwiftMailer for Phalcon.
## Installing ##
Install composer in a common location or in your project:
curl -s http://getcomposer.org/installer | php
Create the composer.json file as follows:
```
{
"require": {
"phalcon-ext/mailer": "~2.0"
}
}
```
Run the composer installer:
```bash
php composer.phar install
```
Add in your the code
require_once('vendor/autoload.php');
## Configure ##
**SMTP**
```php
$config = [
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'encryption' => 'ssl',
'username' => 'example@gmail.com',
'password' => 'your_password',
'from' => [
'email' => 'example@gmail.com',
'name' => 'YOUR FROM NAME'
]
];
```
> **Warning**
> If you are using GMAIL and get error `...Username and Password not accepted...` or `password incorrect`,
> please using password token ([how get token?](https://support.google.com/accounts/answer/185833)) and fix in configuration
>
> ```php
> ...
>
> 'username' => 'example@gmail.com',
> 'password' => 'your_password_token',
>
> ...
> ```
**Sendmail**
```php
$config = [
'driver' => 'sendmail',
'sendmail' => '/usr/sbin/sendmail -bs',
'from' => [
'email' => 'example@gmail.com',
'name' => 'YOUR FROM NAME'
]
];
```
**PHP Mail**
```php
$config = [
'driver' => 'mail',
'from' => [
'email' => 'example@gmail.com',
'name' => 'YOUR FROM NAME'
]
];
```
## Example ##
### createMessage() ###
```php
$mailer = new \Phalcon\Ext\Mailer\Manager($config);
$message = $mailer->createMessage()
->to('example_to@gmail.com', 'OPTIONAL NAME')
->subject('Hello world!')
->content('Hello world!');
// Set the Cc addresses of this message.
$message->cc('example_cc@gmail.com');
// Set the Bcc addresses of this message.
$message->bcc('example_bcc@gmail.com');
// Send message
$message->send();
```
### createMessageFromView() ###
> **Warning**
> If you want to use as a template engine VOLT (.volt),
> please setup "view" service according to the official [docs](http://docs.phalconphp.com/en/latest/reference/volt.html#activating-volt) Phalcon
```php
/**
* Global viewsDir for current instance Mailer\Manager.
*
* This parameter is OPTIONAL, If it is not specified,
* use DI from "view" service (getViewsDir)
*/
$config['viewsDir'] = __DIR__ . '/views/email/';
$mailer = new \Phalcon\Ext\Mailer\Manager($config);
// view relative to the folder viewsDir (REQUIRED)
$viewPath = 'email/example_message';
// Set variables to views (OPTIONAL)
$params [
'var1' => 'VAR VALUE 1',
'var2' => 'VAR VALUE 2',
...
'varN' => 'VAR VALUE N',
];
/**
* The local path to the folder viewsDir only this message. (OPTIONAL)
*
* This parameter is OPTIONAL, If it is not specified,
* use global parameter "viewsDir" from configuration.
*/
$viewsDirLocal = __DIR__ . '/views/email/local/';
$message = $mailer->createMessageFromView($viewPath, $params, $viewsDirLocal)
->to('example_to@gmail.com', 'OPTIONAL NAME')
->subject('Hello world!');
// Set the Cc addresses of this message.
$message->cc('example_cc@gmail.com');
// Set the Bcc addresses of this message.
$message->bcc('example_bcc@gmail.com');
// Send message
$message->send();
```
## Events ##
- mailer:beforeCreateMessage
- mailer:afterCreateMessage
- mailer:beforeSend
- mailer:afterSend
- mailer:beforeAttachFile
- mailer:afterAttachFile
|
phalcon-ext/mailer
|
README.md
|
Markdown
|
mit
| 3,476
|
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20130626195556 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE Player ADD carrier VARCHAR(255) DEFAULT NULL");
}
public function down(Schema $schema)
{
// this down() migration is autogenerated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->addSql("ALTER TABLE Player DROP carrier");
}
}
|
amsross/Ultimatefris.be
|
app/DoctrineMigrations/Version20130626195556.php
|
PHP
|
mit
| 849
|
---
layout: post
title: "Plério"
modified:
categories: contos
excerpt:
tags: [plério,contos,princesa]
image:
feature:
comments: true
share: true
date: 2014-08-11T16:39:55-04:00
---
A princesa perdida em seus pensamentos
mesmo em um momento como esse
onde qualquer tolo erro ou hesitação pode ser fatal
Desnudou-se de suas defesas
desprezou seu orgulho
e abandonou seus princípios
Afundou-se em si mesma
Recapitulou cada cena com fervor
Em busca da razão e do precioso sentido
adentrou-se no castelo de seu próprio coração
lá escutou o ininterrupto gotejar
mas qual sabor teria tal líquido?
Tal pensamento desvaneceu-se de sua mente ao sentir
o cheiro ébrio que permeava toda a estrutura do castelo
Terror!
Seus olhos não podiam estar certos...
Nas paredes, nas escadas e no teto
os dizeres:
***
"De cada poro de teu corpo
sairá aquilo que lhe é mais caro
desejarás que fosses teu sangue
mas será teu único abrigo
e, com isso, choverá sobre teu
corpo vazio"
|
adultangst/adultangst.github.io
|
_posts/contos/2014-08-12-plerio.md
|
Markdown
|
mit
| 1,028
|
var Joi = require('joi');
var ObjectAssign = require('object-assign');
var BaseModel = require('hapi-mongo-models').BaseModel;
var Slug = require('slug');
var AdminGroup = BaseModel.extend({
constructor: function (attrs) {
ObjectAssign(this, attrs);
},
hasPermissionTo: function (permission) {
if (this.permissions && this.permissions.hasOwnProperty(permission)) {
return this.permissions[permission];
}
return false;
}
});
AdminGroup._collection = 'adminGroups';
AdminGroup._idClass = String;
AdminGroup.schema = Joi.object().keys({
_id: Joi.string(),
name: Joi.string().required(),
permissions: Joi.object().description('{ permission: boolean, ... }')
});
AdminGroup.create = function (name, callback) {
var document = {
_id: Slug(name).toLowerCase(),
name: name
};
this.insertOne(document, function (err, docs) {
if (err) {
return callback(err);
}
callback(null, docs[0]);
});
};
module.exports = AdminGroup;
|
williamle8300/aqua
|
server/models/admin-group.js
|
JavaScript
|
mit
| 1,001
|
package com.codingpan.leetcode.todo;
import edu.princeton.cs.algs4.StdOut;
public class LC877StoneGames {
public boolean stoneGame(int[] piles) {
if (piles == null || piles.length == 0) return false;
return f(piles, 0, piles.length - 1) > s(piles, 0, piles.length - 1);
}
private int f(int[] stones, int l, int r) {
if (l > r) return 0;
return Math.max(s(stones, l + 1, r) + stones[l], s(stones, l, r - 1) + stones[r]);
}
private int s(int[] stones, int l, int r) {
if (l == r) return stones[l];
return Math.min(f(stones, l + 1, r), f(stones, l, r - 1));
}
public static void main(String[] args) {
LC877StoneGames solu = new LC877StoneGames();
int[] piles = {5, 3, 4, 5};
boolean res = solu.stoneGame(piles);
StdOut.println("expected (true): " + res);
}
}
|
wszdwp/AlgorithmPractice
|
src/main/java/com/codingpan/leetcode/todo/LC877StoneGames.java
|
Java
|
mit
| 873
|
---
title: shipcloud webhooks response JSON schema
---
{% highlight json %}
{% include schemas/webhooks_response.json %}
{% endhighlight %}
[<i class="fas fa-download"></i> download]({{ site.baseurl }}/schemas/webhooks_response.json)
|
shipcloud/shipcloud.github.io
|
reference/webhooks_response_schema.md
|
Markdown
|
mit
| 236
|
namespace UiMetadataFramework.Web
{
using System.IO;
using Microsoft.AspNetCore.Hosting;
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
UNOPS/UiMetadataFramework
|
UiMetadataFramework.Web/Program.cs
|
C#
|
mit
| 391
|
/* wld: wayland-shm.c
*
* Copyright (c) 2013, 2014 Michael Forney
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#define _GNU_SOURCE /* Required for mkostemp */
#include "pixman.h"
#include "wayland-private.h"
#include "wayland.h"
#include "wld-private.h"
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <wayland-client.h>
struct shm_context {
struct wayland_context base;
struct wl_registry *registry;
struct wl_shm *wl;
struct wl_array formats;
};
struct shm_buffer {
struct buffer base;
int fd;
};
#define WAYLAND_IMPL_NAME shm
#include "interface/buffer.h"
#include "interface/context.h"
#include "interface/wayland.h"
IMPL(shm_context, wld_context)
IMPL(shm_buffer, wld_buffer)
static void registry_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface,
uint32_t version);
static void registry_global_remove(void *data, struct wl_registry *registry,
uint32_t name);
static void shm_format(void *data, struct wl_shm *wl, uint32_t format);
const static struct wl_registry_listener registry_listener = {
.global = ®istry_global,
.global_remove = ®istry_global_remove
};
const static struct wl_shm_listener shm_listener = {
.format = &shm_format,
};
static inline uint32_t
format_wld_to_shm(uint32_t format)
{
switch (format) {
case WLD_FORMAT_ARGB8888:
return WL_SHM_FORMAT_ARGB8888;
case WLD_FORMAT_XRGB8888:
return WL_SHM_FORMAT_XRGB8888;
default:
return 0;
}
}
struct wayland_context *
wayland_create_context(struct wl_display *display,
struct wl_event_queue *queue)
{
struct shm_context *context;
if (!(context = malloc(sizeof *context)))
goto error0;
context_initialize(&context->base.base, &wld_context_impl);
context->wl = NULL;
wl_array_init(&context->formats);
if (!(context->registry = wl_display_get_registry(display))) {
DEBUG("Couldn't get registry\n");
goto error1;
}
wl_registry_add_listener(context->registry, ®istry_listener, context);
wl_proxy_set_queue((struct wl_proxy *)context->registry, queue);
/* Wait for wl_shm global. */
wl_display_roundtrip_queue(display, queue);
if (!context->wl) {
DEBUG("No wl_shm global\n");
goto error2;
}
wl_shm_add_listener(context->wl, &shm_listener, context);
/* Wait for SHM formats. */
wl_display_roundtrip_queue(display, queue);
return &context->base;
error2:
wl_registry_destroy(context->registry);
error1:
wl_array_release(&context->formats);
free(context);
error0:
return NULL;
}
bool
wayland_has_format(struct wld_context *base, uint32_t format)
{
struct shm_context *context = shm_context(base);
uint32_t *supported_format;
uint32_t shm_format = format_wld_to_shm(format);
wl_array_for_each (supported_format, &context->formats) {
if (*supported_format == shm_format)
return true;
}
return false;
}
struct wld_renderer *
context_create_renderer(struct wld_context *context)
{
return wld_create_renderer(wld_pixman_context);
}
struct buffer *
context_create_buffer(struct wld_context *base,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags)
{
struct shm_context *context = shm_context(base);
struct shm_buffer *buffer;
char name[] = "/tmp/wld-XXXXXX";
uint32_t pitch = width * format_bytes_per_pixel(format);
size_t size = pitch * height;
int fd;
struct wl_shm_pool *pool;
struct wl_buffer *wl;
if (!wayland_has_format(base, format))
goto error0;
if (!(buffer = malloc(sizeof *buffer)))
goto error0;
fd = mkostemp(name, O_CLOEXEC);
if (fd < 0)
goto error1;
unlink(name);
if (posix_fallocate(fd, 0, size) != 0 && ftruncate(fd, size) != 0)
goto error2;
if (!(pool = wl_shm_create_pool(context->wl, fd, size)))
goto error2;
wl = wl_shm_pool_create_buffer(pool, 0, width, height, pitch,
format_wld_to_shm(format));
wl_shm_pool_destroy(pool);
if (!wl)
goto error2;
buffer_initialize(&buffer->base, &wld_buffer_impl,
width, height, format, pitch);
buffer->fd = fd;
if (!(wayland_buffer_add_exporter(&buffer->base, wl)))
goto error3;
return &buffer->base;
error3:
wl_buffer_destroy(wl);
error2:
close(fd);
error1:
free(buffer);
error0:
return NULL;
}
struct buffer *
context_import_buffer(struct wld_context *context,
uint32_t type, union wld_object object,
uint32_t width, uint32_t height,
uint32_t format, uint32_t pitch)
{
return NULL;
}
void
context_destroy(struct wld_context *base)
{
struct shm_context *context = shm_context(base);
wl_shm_destroy(context->wl);
wl_registry_destroy(context->registry);
wl_array_release(&context->formats);
wl_event_queue_destroy(context->base.queue);
free(context);
}
/**** Buffer ****/
bool
buffer_map(struct buffer *base)
{
struct shm_buffer *buffer = shm_buffer(&base->base);
void *data;
data = mmap(NULL, buffer->base.base.pitch * buffer->base.base.height,
PROT_READ | PROT_WRITE, MAP_SHARED, buffer->fd, 0);
if (data == MAP_FAILED)
return false;
buffer->base.base.map = data;
return true;
}
bool
buffer_unmap(struct buffer *buffer)
{
if (munmap(buffer->base.map,
buffer->base.pitch * buffer->base.height)
== -1) {
return false;
}
buffer->base.map = NULL;
return true;
}
void
buffer_destroy(struct buffer *base)
{
struct shm_buffer *buffer = shm_buffer(&base->base);
close(buffer->fd);
free(buffer);
}
void
registry_global(void *data, struct wl_registry *registry, uint32_t name,
const char *interface, uint32_t version)
{
struct shm_context *context = data;
if (strcmp(interface, "wl_shm") == 0)
context->wl = wl_registry_bind(registry, name, &wl_shm_interface, 1);
}
void
registry_global_remove(void *data, struct wl_registry *registry,
uint32_t name)
{
}
void
shm_format(void *data, struct wl_shm *wl, uint32_t format)
{
struct shm_context *context = data;
uint32_t *added_format;
if (!(added_format = wl_array_add(&context->formats, sizeof format)))
return;
*added_format = format;
}
|
michaelforney/wld
|
wayland-shm.c
|
C
|
mit
| 7,280
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SoccerManager.UI.Base
{
public class BaseForm : Form
{
public BaseForm()
{
KeyPreview = true;
KeyDown += BaseForm_KeyDown;
}
private void BaseForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SelectNextControl(ActiveControl, !e.Shift, true, true, true);
e.Handled = true;
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.Escape)
{
if (Application.OpenForms.Count > 1)
Close();
else
Application.Exit();
e.Handled = true;
e.SuppressKeyPress = true;
}
}
public BaseForm(Form form) : this()
{
MdiParent = form.MdiParent ?? form;
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (Application.OpenForms.Count == 1)
{
var result = MessageBox.Show("Deseja realmente sair?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
base.OnClosing(e);
else
e.Cancel = true;
}
}
}
}
|
leonardoacoelho/Soccer_Manager
|
SoccerManager/SoccerManager.UI/Base/BaseForm.cs
|
C#
|
mit
| 1,550
|
# games-http-cards-war
Basic "war" card game on Ruby Rails. Needlessly using a database for practicing / learning.
|
austinpeters/games-http-cards-war
|
README.md
|
Markdown
|
mit
| 115
|
---
title: Statistical regression modeling
---
Here I investigate the relationship between car speed and stop distance in feet. Data from 1920s.
Taking a stab at regression visualization, using both lowess and abline techniques.
I will be looking further at the more technical statistical applications of r in future blogs.
> data()
> head(cars)
speed dist
1 4 2
2 4 10
3 7 4
4 7 22
5 8 16
6 9 10
> tail(cars)
speed dist
45 23 54
46 24 70
47 24 92
48 24 93
49 24 120
50 25 85
> attach(cars) #why attach? makes easier to access without explicitly recalling, I think
> plot(speed,dist,main="brake performance",xlab="speed",ylab="dist",pch=19)

> abline(lm(dist~speed),col="red") #regression line
> lines(lowess(speed,dist),col="blue") #lowess
#note: lowess smoothing is best when line of best is hard to determine
#or lease squares fitting doesn't create a good line of best fit

I checked with the R documentation, and here is what they have, as a note to myself for later:
> plot(cars, xlab = "Speed (mph)", ylab = "Stopping distance (ft)",
+ las = 1, xlim = c(0, 25))
> d <- seq(0, 25, length.out = 200)
> for(degree in 1:4) {
+ fm <- lm(dist ~ poly(speed, degree), data = cars)
+ assign(paste("cars", degree, sep = "."), fm)
+ lines(d, predict(fm, data.frame(speed = d)), col = degree)
+ }
> anova(cars.1, cars.2, cars.3, cars.4)
Analysis of Variance Table
Model 1: dist ~ poly(speed, degree)
Model 2: dist ~ poly(speed, degree)
Model 3: dist ~ poly(speed, degree)
Model 4: dist ~ poly(speed, degree)
Res.Df RSS Df Sum of Sq F Pr(>F)
1 48 11354
2 47 10825 1 528.81 2.3108 0.1355
3 46 10634 1 190.35 0.8318 0.3666
4 45 10298 1 336.55 1.4707 0.2316

It looks like they assigned a polynomial regression. After looking into this a bit, I realized I should really be looking at r-squared, d.f., and P values to really determine fit.
So looking into how to find r-squared, I tried this:
> summary(lm(dist~speed))$r.squared #regression line
[1] 0.6510794
> summary(lowess(speed,dist))$r.squared #and naturally the lowess line
Error in summary(lowess(speed, dist))$r.squared :
$ operator is invalid for atomic vectors
But why is this invalid? $ only valid for recursive objects. Ok, let's go another direction, P value, which should be a better indicator of fit.
My t-test for cars revealed this:
> t.test(cars)
One Sample t-test
data: cars
t = 12.625, df = 99, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
24.60221 33.77779
sample estimates:
mean of x
29.19
I'll make this a question for next time: how to get measures of fit like P value along with lines of regression? Like [this site](http://www.dmi.units.it/~inverniz/adir/statcurvreg.html) did.
|
eastandwestwind/notes
|
_posts/2015-07-29-cars.md
|
Markdown
|
mit
| 3,066
|
<?php
namespace HechoEnMx\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\HechoEnMx\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\HechoEnMx\Http\Middleware\VerifyCsrfToken::class,
];
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \HechoEnMx\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'guest' => \HechoEnMx\Http\Middleware\RedirectIfAuthenticated::class,
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
];
}
|
wafto/hechoenmx
|
app/Http/Kernel.php
|
PHP
|
mit
| 1,155
|
package com.eaw1805.www.client.asyncs.army;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.eaw1805.data.dto.web.army.BrigadeDTO;
import com.eaw1805.www.client.views.layout.ForceReloadPanel;
import com.eaw1805.www.shared.stores.units.ArmyStore;
import java.util.List;
import java.util.Map;
public class ArmyNewAsyncCallback
implements AsyncCallback<Map<Integer, List<BrigadeDTO>>> {
public void onFailure(final Throwable caught) {
// Do nothing
ForceReloadPanel.getInstance().addFail("New armies").center();
}
public void onSuccess(final Map<Integer, List<BrigadeDTO>> result) {
ArmyStore.getInstance().initNewBrigades(result);
}
}
|
EaW1805/www
|
src/main/java/com/eaw1805/www/client/asyncs/army/ArmyNewAsyncCallback.java
|
Java
|
mit
| 702
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.cghislai.organiseurilesdepaix.view.control;
import com.cghislai.organiseurilesdepaix.domain.User;
import com.cghislai.organiseurilesdepaix.service.UserService;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
/**
*
* @author cghislai
*/
@Named
@ViewScoped
public class UserController implements Serializable {
@EJB
private UserService userService;
@Inject
private AuthController authController;
private String password1;
private String password2;
@PostConstruct
public void init() {
password1 = null;
password2 = null;
}
public void actionSave() {
User authenticatedUser = authController.getAuthenticatedUser();
String encodedPassword = LoginController.encodePassword(password1);
authenticatedUser.setPasswordHash(encodedPassword);
userService.saveUser(authenticatedUser);
FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, "Enregistré", null);
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, facesMessage);
}
public String getPassword1() {
return password1;
}
public void setPassword1(String password1) {
this.password1 = password1;
}
public String getPassword2() {
return password2;
}
public void setPassword2(String password2) {
this.password2 = password2;
}
}
|
cghislai/organiseur
|
OrganiseurIlesDePaix/src/main/java/com/cghislai/organiseurilesdepaix/view/control/UserController.java
|
Java
|
mit
| 1,850
|
using CodeJam._2015.QualificationRound.InfiniteHouseOfPancakes.src;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tests._2015.QualificationRound
{
[TestClass]
public class InfiniteHouseOfPancakesTest
{
[TestMethod]
public void DinersEatTest()
{
var solver = new Solver();
var array = new int[6] { 0, 4, 3, 1, 2, 4 };
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[5] { 4, 3, 1, 2, 4 }, array);
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[4] { 3, 1, 2, 4 }, array);
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[3] { 1, 2, 4 }, array);
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[2] { 2, 4 }, array);
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[1] { 4 }, array);
array = solver.DinersEat(array);
CollectionAssert.AreEqual(new int[0], array);
}
[TestMethod]
public void RedistibutePancakesTest()
{
var solver = new Solver();
var array = new int[6] { 0, 4, 3, 1, 2, 4 };
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[5] { 0, 4, 7, 5, 2 }, array);
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[4] { 0, 4, 11, 5 }, array);
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[3] { 0, 9, 16 }, array);
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[2] { 0, 41 }, array);
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[2] { 41, 41 }, array);
array = new int[9] { 0, 0, 0, 1, 1, 0, 0, 1, 2 };
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[8] { 0, 0, 0, 1, 5, 0, 0, 1 }, array);
array = solver.RedistibutePancakes(array);
CollectionAssert.AreEqual(new int[5] { 0, 0, 0, 2, 6 }, array);
}
[TestMethod]
public void ReadLineTwoTest()
{
var reader = new InputReader();
var array = reader.ReadLineTwo("4 8 7 8 3");
CollectionAssert.AreEqual(new int[9] { 0, 0, 0, 1, 1, 0, 0, 1, 2 }, array);
}
[TestMethod]
public void SolveTest()
{
var solver = new Solver();
var reader = new InputReader();
var array = reader.ReadLineTwo("3");
var minutes = solver.Solve(array);
Assert.AreEqual(3, minutes);
array = reader.ReadLineTwo("1 2 1 2");
minutes = solver.Solve(array);
Assert.AreEqual(2, minutes);
array = reader.ReadLineTwo("4");
minutes = solver.Solve(array);
Assert.AreEqual(3, minutes);
array = reader.ReadLineTwo("2 1");
minutes = solver.Solve(array);
Assert.AreEqual(2, minutes);
array = reader.ReadLineTwo("4 8 7 8 3");
minutes = solver.Solve(array);
Assert.AreEqual(7, minutes);
array = reader.ReadLineTwo("3 1 5 5 1");
minutes = solver.Solve(array);
Assert.AreEqual(5, minutes);
array = reader.ReadLineTwo("6 5 4 3 2 1");
minutes = solver.Solve(array);
Assert.AreEqual(6, minutes);
array = reader.ReadLineTwo("8 8 8");
minutes = solver.Solve(array);
Assert.AreEqual(7, minutes);
array = reader.ReadLineTwo("9");
minutes = solver.Solve(array);
Assert.AreEqual(5, minutes);
}
}
}
|
michaelmilessmith/code-jam-solutions
|
C#/Tests/2015/QualificationRound/InfiniteHouseOfPancakesTest.cs
|
C#
|
mit
| 3,885
|
CHANGELOG_BAK=/tmp/qtav_changelog
mkchangelog() {
cat >debian/changelog<<EOF
qtav ($1) $2; urgency=low
* Upstream update
-- Wang Bin (Lucas) <wbsecg1@gmail.com> $(LANG=C date -R)
`cat $CHANGELOG_BAK`
EOF
}
DISTRIBUTIONS=(trusty vivid wily xenial)
DATE=`date -d @$(git log -n1 --format="%at") +%Y%m%d`
for D in ${DISTRIBUTIONS[@]}; do
git checkout -- debian/changelog
cp -avf debian/changelog $CHANGELOG_BAK
VER=1.10.0~`git log -1 --pretty=format:"git${DATE}.%h~${D}" 2> /dev/null`
mkchangelog $VER $D
debuild -S -sa
dput -f ppa:wbsecg1/qtav ../qtav_${VER}_source.changes
cp -avf $CHANGELOG_BAK debian/changelog
done
|
fuyanzhi1234/DevelopQt
|
QtAV-master/debian/ubuntu.sh
|
Shell
|
mit
| 640
|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['services/votes/(.*)/(.*)'] = "services/postVote/$1/$2";
$route['services/(.*)'] = "services/$1";
$route['default_controller'] = 'polls';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
|
agronauts/poll
|
application/config/routes.php
|
PHP
|
mit
| 2,074
|
'''
Build a tweet sentiment analyzer
'''
from __future__ import print_function
import cPickle as pickle
import sys
import time
from collections import OrderedDict
import numpy
import theano
import theano.tensor as tensor
from theano import config
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import imdb
datasets = {'imdb': (imdb.load_data, imdb.prepare_data)}
# Set the random number generators' seeds for consistency
SEED = 123
numpy.random.seed(SEED)
def numpy_floatX(data):
return numpy.asarray(data, dtype=config.floatX)
# NOTE (bitesandbytes) : Important; set minibatch_size = 1 ?
def get_minibatches_idx(n, minibatch_size, shuffle=False):
"""
Used to shuffle the dataset at each iteration.
"""
idx_list = numpy.arange(n, dtype="int32")
if shuffle:
numpy.random.shuffle(idx_list)
minibatches = []
minibatch_start = 0
for i in range(n // minibatch_size):
minibatches.append(idx_list[minibatch_start:
minibatch_start + minibatch_size])
minibatch_start += minibatch_size
if (minibatch_start != n):
# Make a minibatch out of what is left
minibatches.append(idx_list[minibatch_start:])
return zip(range(len(minibatches)), minibatches)
# NOTE (bitesandbytes) : Not needed.
def get_dataset(name):
return datasets[name][0], datasets[name][1]
def zipp(params, tparams):
"""
When we reload the model. Needed for the GPU stuff.
"""
for kk, vv in params.items():
tparams[kk].set_value(vv)
def unzip(zipped):
"""
When we pickle the model. Needed for the GPU stuff.
"""
new_params = OrderedDict()
for kk, vv in zipped.items():
new_params[kk] = vv.get_value()
return new_params
def dropout_layer(state_before, use_noise, trng):
proj = tensor.switch(use_noise,
(state_before *
trng.binomial(state_before.shape,
p=0.5, n=1,
dtype=state_before.dtype)),
state_before * 0.5)
return proj
def _p(pp, name):
return '%s_%s' % (pp, name)
def init_params(options):
"""
Global (not LSTM) parameter. For the embedding and the classifier.
"""
params = OrderedDict()
params = get_layer(options['encoder'])[0](options,
params,
prefix=options['encoder'])
# classifier
params['U'] = 0.01 * numpy.random.randn(options['dim_proj'],
options['ydim']).astype(config.floatX)
params['b'] = numpy.zeros((options['ydim'],)).astype(config.floatX)
return params
def load_params(path, params):
pp = numpy.load(path)
for kk, vv in params.items():
if kk not in pp:
raise Warning('%s is not in the archive' % kk)
params[kk] = pp[kk]
return params
def init_tparams(params):
tparams = OrderedDict()
for kk, pp in params.items():
tparams[kk] = theano.shared(params[kk], name=kk)
return tparams
def get_layer(name):
fns = layers[name]
return fns
def ortho_weight(ndim):
W = numpy.random.randn(ndim, ndim)
u, s, v = numpy.linalg.svd(W)
return u.astype(config.floatX)
def param_init_lstm(options, params, prefix='lstm'):
"""
Init the LSTM parameter:
:see: init_params
"""
W = numpy.concatenate([ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj'])], axis=1)
params[_p(prefix, 'W')] = W
U = numpy.concatenate([ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj']),
ortho_weight(options['dim_proj'])], axis=1)
params[_p(prefix, 'U')] = U
b = numpy.zeros((4 * options['dim_proj'],))
params[_p(prefix, 'b')] = b.astype(config.floatX)
return params
def lstm_layer(tparams, state_below, options, prefix='lstm', mask=None):
nsteps = state_below.shape[0]
if state_below.ndim == 3:
n_samples = state_below.shape[1]
else:
n_samples = 1
assert mask is not None
def _slice(_x, n, dim):
if _x.ndim == 3:
return _x[:, :, n * dim:(n + 1) * dim]
return _x[:, n * dim:(n + 1) * dim]
def _step(m_, x_, h_, c_):
preact = tensor.dot(h_, tparams[_p(prefix, 'U')])
preact += x_
i = tensor.nnet.sigmoid(_slice(preact, 0, options['dim_proj']))
f = tensor.nnet.sigmoid(_slice(preact, 1, options['dim_proj']))
o = tensor.nnet.sigmoid(_slice(preact, 2, options['dim_proj']))
c = tensor.tanh(_slice(preact, 3, options['dim_proj']))
c = f * c_ + i * c
c = m_[:, None] * c + (1. - m_)[:, None] * c_
h = o * tensor.tanh(c)
h = m_[:, None] * h + (1. - m_)[:, None] * h_
return h, c
# Donno what this is doing :/
state_below = (tensor.dot(state_below, tparams[_p(prefix, 'W')]) +
tparams[_p(prefix, 'b')])
dim_proj = options['dim_proj']
rval, updates = theano.scan(_step,
sequences=[mask, state_below],
outputs_info=[tensor.alloc(numpy_floatX(0.),
n_samples,
dim_proj),
tensor.alloc(numpy_floatX(0.),
n_samples,
dim_proj)],
name=_p(prefix, '_layers'),
n_steps=nsteps)
return rval[0]
# ff: Feed Forward (normal neural net), only useful to put after lstm
# before the classifier.
layers = {'lstm': (param_init_lstm, lstm_layer)}
def sgd(lr, tparams, grads, x, mask, y, cost):
""" Stochastic Gradient Descent
:note: A more complicated version of sgd then needed. This is
done like that for adadelta and rmsprop.
"""
# New set of shared variable that will contain the gradient
# for a mini-batch.
gshared = [theano.shared(p.get_value() * 0., name='%s_grad' % k)
for k, p in tparams.items()]
gsup = [(gs, g) for gs, g in zip(gshared, grads)]
# Function that computes gradients for a mini-batch, but do not
# updates the weights.
f_grad_shared = theano.function([x, mask, y], cost, updates=gsup,
name='sgd_f_grad_shared')
pup = [(p, p - lr * g) for p, g in zip(tparams.values(), gshared)]
# Function that updates the weights from the previously computed
# gradient.
f_update = theano.function([lr], [], updates=pup,
name='sgd_f_update')
return f_grad_shared, f_update
def adadelta(lr, tparams, grads, x, mask, y, cost):
"""
An adaptive learning rate optimizer
Parameters
----------
lr : Theano SharedVariable
Initial learning rate
tpramas: Theano SharedVariable
Model parameters
grads: Theano variable
Gradients of cost w.r.t to parameres
x: Theano variable
Model inputs
mask: Theano variable
Sequence mask
y: Theano variable
Targets
cost: Theano variable
Objective fucntion to minimize
Notes
-----
For more information, see [ADADELTA]_.
.. [ADADELTA] Matthew D. Zeiler, *ADADELTA: An Adaptive Learning
Rate Method*, arXiv:1212.5701.
"""
zipped_grads = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_grad' % k)
for k, p in tparams.items()]
running_up2 = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_rup2' % k)
for k, p in tparams.items()]
running_grads2 = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_rgrad2' % k)
for k, p in tparams.items()]
zgup = [(zg, g) for zg, g in zip(zipped_grads, grads)]
rg2up = [(rg2, 0.95 * rg2 + 0.05 * (g ** 2))
for rg2, g in zip(running_grads2, grads)]
f_grad_shared = theano.function([x, mask, y], cost, updates=zgup + rg2up,
name='adadelta_f_grad_shared')
updir = [-tensor.sqrt(ru2 + 1e-6) / tensor.sqrt(rg2 + 1e-6) * zg
for zg, ru2, rg2 in zip(zipped_grads,
running_up2,
running_grads2)]
ru2up = [(ru2, 0.95 * ru2 + 0.05 * (ud ** 2))
for ru2, ud in zip(running_up2, updir)]
param_up = [(p, p + ud) for p, ud in zip(tparams.values(), updir)]
f_update = theano.function([lr], [], updates=ru2up + param_up,
on_unused_input='ignore',
name='adadelta_f_update')
return f_grad_shared, f_update
def rmsprop(lr, tparams, grads, x, mask, y, cost):
"""
A variant of SGD that scales the step size by running average of the
recent step norms.
Parameters
----------
lr : Theano SharedVariable
Initial learning rate
tpramas: Theano SharedVariable
Model parameters
grads: Theano variable
Gradients of cost w.r.t to parameres
x: Theano variable
Model inputs
mask: Theano variable
Sequence mask
y: Theano variable
Targets
cost: Theano variable
Objective fucntion to minimize
Notes
-----
For more information, see [Hint2014]_.
.. [Hint2014] Geoff Hinton, *Neural Networks for Machine Learning*,
lecture 6a,
http://cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf
"""
zipped_grads = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_grad' % k)
for k, p in tparams.items()]
running_grads = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_rgrad' % k)
for k, p in tparams.items()]
running_grads2 = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_rgrad2' % k)
for k, p in tparams.items()]
zgup = [(zg, g) for zg, g in zip(zipped_grads, grads)]
rgup = [(rg, 0.95 * rg + 0.05 * g) for rg, g in zip(running_grads, grads)]
rg2up = [(rg2, 0.95 * rg2 + 0.05 * (g ** 2))
for rg2, g in zip(running_grads2, grads)]
f_grad_shared = theano.function([x, mask, y], cost,
updates=zgup + rgup + rg2up,
name='rmsprop_f_grad_shared')
updir = [theano.shared(p.get_value() * numpy_floatX(0.),
name='%s_updir' % k)
for k, p in tparams.items()]
updir_new = [(ud, 0.9 * ud - 1e-4 * zg / tensor.sqrt(rg2 - rg ** 2 + 1e-4))
for ud, zg, rg, rg2 in zip(updir, zipped_grads, running_grads,
running_grads2)]
param_up = [(p, p + udn[1])
for p, udn in zip(tparams.values(), updir_new)]
f_update = theano.function([lr], [], updates=updir_new + param_up,
on_unused_input='ignore',
name='rmsprop_f_update')
return f_grad_shared, f_update
def build_model(tparams, options):
trng = RandomStreams(SEED)
# Used for dropout.
use_noise = theano.shared(numpy_floatX(0.))
x = tensor.matrix('x', dtype='int64')
mask = tensor.matrix('mask', dtype=config.floatX)
y = tensor.vector('y', dtype='int64')
n_timesteps = x.shape[0]
n_samples = x.shape[1]
proj = get_layer(options['encoder'])[1](tparams, x, options,
prefix=options['encoder'],
mask=mask)
if options['encoder'] == 'lstm':
proj = (proj * mask[:, :, None]).sum(axis=0)
proj = proj / mask.sum(axis=0)[:, None]
if options['use_dropout']:
proj = dropout_layer(proj, use_noise, trng)
pred = tensor.nnet.softmax(tensor.dot(proj.T, tparams['U']) + tparams['b'])
f_pred_prob = theano.function([x, mask], pred, name='f_pred_prob')
f_pred = theano.function([x, mask], pred.argmax(axis=1), name='f_pred')
off = 1e-8
if pred.dtype == 'float16':
off = 1e-6
cost = -tensor.log(pred[tensor.arange(n_samples), y] + off).mean()
return use_noise, x, mask, y, f_pred_prob, f_pred, cost
def pred_probs(f_pred_prob, prepare_data, data, iterator, verbose=False):
""" If you want to use a trained model, this is useful to compute
the probabilities of new examples.
"""
n_samples = len(data[0])
probs = numpy.zeros((n_samples, 2)).astype(config.floatX)
n_done = 0
for _, valid_index in iterator:
x, mask, y = prepare_data([data[0][t] for t in valid_index],
numpy.array(data[1])[valid_index],
maxlen=None)
pred_probs = f_pred_prob(x, mask)
probs[valid_index, :] = pred_probs
n_done += len(valid_index)
if verbose:
print('%d/%d samples classified' % (n_done, n_samples))
return probs
def pred_error(f_pred, prepare_data, data, iterator, verbose=False):
"""
Just compute the error
f_pred: Theano fct computing the prediction
prepare_data: usual prepare_data for that dataset.
"""
valid_err = 0
for _, valid_index in iterator:
x, mask, y = prepare_data([data[0][t] for t in valid_index],
numpy.array(data[1])[valid_index],
maxlen=None)
preds = f_pred(x, mask)
targets = numpy.array(data[1])[valid_index]
valid_err += (preds == targets).sum()
valid_err = 1. - numpy_floatX(valid_err) / len(data[0])
return valid_err
def train_lstm(
dim_proj=128, # word embeding dimension and LSTM number of hidden units.
patience=10, # Number of epoch to wait before early stop if no progress
max_epochs=5000, # The maximum number of epoch to run
dispFreq=10, # Display to stdout the training progress every N updates
decay_c=0., # Weight decay for the classifier applied to the U weights.
lrate=0.0001, # Learning rate for sgd (not used for adadelta and rmsprop)
n_words=10000, # Vocabulary size
optimizer=adadelta,
# sgd, adadelta and rmsprop available, sgd very hard to use, not recommanded (probably need momentum and decaying learning rate).
encoder='lstm', # TODO: can be removed must be lstm.
saveto='lstm_model.npz', # The best model will be saved there
validFreq=370, # Compute the validation error after this number of update.
saveFreq=1110, # Save the parameters after every saveFreq updates
maxlen=100, # Sequence longer then this get ignored
batch_size=16, # The batch size during training.
valid_batch_size=64, # The batch size used for validation/test set.
dataset='imdb',
# Parameter for extra option
noise_std=0.,
use_dropout=True, # if False slightly faster, but worst test error
# This frequently need a bigger model.
reload_model=None, # Path to a saved model we want to start from.
test_size=-1, # If >0, we keep only this number of test example.
):
# Model options
model_options = locals().copy()
print("model options", model_options)
load_data, prepare_data = get_dataset(dataset)
print('Loading data')
train, valid, test = load_data(n_words=n_words, valid_portion=0.05,
maxlen=maxlen)
if test_size > 0:
# The test set is sorted by size, but we want to keep random
# size example. So we must select a random selection of the
# examples.
idx = numpy.arange(len(test[0]))
numpy.random.shuffle(idx)
idx = idx[:test_size]
test = ([test[0][n] for n in idx], [test[1][n] for n in idx])
ydim = numpy.max(train[1]) + 1
# TOOD(bitesandbytes) : Change ydim to |num words| + 1 (0 -> no word | empty)
model_options['ydim'] = ydim
print('Building model')
# This create the initial parameters as numpy ndarrays.
# Dict name (string) -> numpy ndarray
params = init_params(model_options)
if reload_model:
load_params('lstm_model.npz', params)
# This create Theano Shared Variable from the parameters.
# Dict name (string) -> Theano Tensor Shared Variable
# params and tparams have different copy of the weights.
tparams = init_tparams(params)
# use_noise is for dropout
(use_noise, x, mask,
y, f_pred_prob, f_pred, cost) = build_model(tparams, model_options)
if decay_c > 0.:
decay_c = theano.shared(numpy_floatX(decay_c), name='decay_c')
weight_decay = 0.
weight_decay += (tparams['U'] ** 2).sum()
weight_decay *= decay_c
cost += weight_decay
f_cost = theano.function([x, mask, y], cost, name='f_cost')
grads = tensor.grad(cost, wrt=list(tparams.values()))
f_grad = theano.function([x, mask, y], grads, name='f_grad')
lr = tensor.scalar(name='lr')
f_grad_shared, f_update = optimizer(lr, tparams, grads,
x, mask, y, cost)
print('Optimization')
kf_valid = get_minibatches_idx(len(valid[0]), valid_batch_size)
kf_test = get_minibatches_idx(len(test[0]), valid_batch_size)
print("%d train examples" % len(train[0]))
print("%d valid examples" % len(valid[0]))
print("%d test examples" % len(test[0]))
history_errs = []
best_p = None
bad_count = 0
if validFreq == -1:
validFreq = len(train[0]) // batch_size
if saveFreq == -1:
saveFreq = len(train[0]) // batch_size
uidx = 0 # the number of update done
estop = False # early stop
start_time = time.time()
try:
for eidx in range(max_epochs):
n_samples = 0
# Get new shuffled index for the training set.
kf = get_minibatches_idx(len(train[0]), batch_size, shuffle=True)
for _, train_index in kf:
uidx += 1
use_noise.set_value(1.)
# Select the random examples for this minibatch
y = [train[1][t] for t in train_index]
x = [train[0][t] for t in train_index]
# Get the data in numpy.ndarray format
# This swap the axis!
# Return something of shape (minibatch maxlen, n samples)
x, mask, y = prepare_data(x, y)
n_samples += x.shape[1]
cost = f_grad_shared(x, mask, y)
f_update(lrate)
if numpy.isnan(cost) or numpy.isinf(cost):
print('bad cost detected: ', cost)
return 1., 1., 1.
if numpy.mod(uidx, dispFreq) == 0:
print('Epoch ', eidx, 'Update ', uidx, 'Cost ', cost)
if saveto and numpy.mod(uidx, saveFreq) == 0:
print('Saving...')
if best_p is not None:
params = best_p
else:
params = unzip(tparams)
numpy.savez(saveto, history_errs=history_errs, **params)
pickle.dump(model_options, open('%s.pkl' % saveto, 'wb'), -1)
print('Done')
if numpy.mod(uidx, validFreq) == 0:
use_noise.set_value(0.)
train_err = pred_error(f_pred, prepare_data, train, kf)
valid_err = pred_error(f_pred, prepare_data, valid,
kf_valid)
test_err = pred_error(f_pred, prepare_data, test, kf_test)
history_errs.append([valid_err, test_err])
if (best_p is None or
valid_err <= numpy.array(history_errs)[:,
0].min()):
best_p = unzip(tparams)
bad_counter = 0
print('Train ', train_err, 'Valid ', valid_err,
'Test ', test_err)
if (len(history_errs) > patience and
valid_err >= numpy.array(history_errs)[:-patience,
0].min()):
bad_counter += 1
if bad_counter > patience:
print('Early Stop!')
estop = True
break
print('Seen %d samples' % n_samples)
if estop:
break
except KeyboardInterrupt:
print("Training interupted")
end_time = time.time()
if best_p is not None:
zipp(best_p, tparams)
else:
best_p = unzip(tparams)
use_noise.set_value(0.)
kf_train_sorted = get_minibatches_idx(len(train[0]), batch_size)
train_err = pred_error(f_pred, prepare_data, train, kf_train_sorted)
valid_err = pred_error(f_pred, prepare_data, valid, kf_valid)
test_err = pred_error(f_pred, prepare_data, test, kf_test)
print('Train ', train_err, 'Valid ', valid_err, 'Test ', test_err)
if saveto:
numpy.savez(saveto, train_err=train_err,
valid_err=valid_err, test_err=test_err,
history_errs=history_errs, **best_p)
print('The code run for %d epochs, with %f sec/epochs' % (
(eidx + 1), (end_time - start_time) / (1. * (eidx + 1))))
print(('Training took %.1fs' %
(end_time - start_time)), file=sys.stderr)
return train_err, valid_err, test_err
if __name__ == '__main__':
# See function train for all possible parameter and there definition.
train_lstm(
max_epochs=100,
test_size=500,
)
|
bitesandbytes/upgraded-system
|
src/vanilla_lstm.py
|
Python
|
mit
| 22,530
|
require 'spec_helper'
RSpec.describe Hsquare::Notification do
describe '#deliver' do
let(:recipient_id) { 123 }
let(:message) { 'message' }
let(:notification) { Hsquare::Notification.new(recipient_id: recipient_id, message: message) }
context 'when no app ids is set' do
it do
Hsquare.config.applications.each do |application|
expect(application.admin_client).to receive(:post).with('/v1/push/send', body: { uuids: [recipient_id].to_json, push_message: { for_apns: { push_alert: true, message: message }, for_gcm: { delay_while_idle: false, custom_field: { message: message, sound: nil } } }.to_json })
end
notification.deliver
end
end
context 'when app ids is set' do
let(:notification) { Hsquare::Notification.new(recipient_id: recipient_id, message: message, app_ids: [nil]) }
it do
Hsquare.config.applications.each do |application|
expect(application.admin_client).to receive(:post).with('/v1/push/send', body: { uuids: [recipient_id].to_json, push_message: { for_apns: { push_alert: true, message: message }, for_gcm: { delay_while_idle: false, custom_field: { message: message, sound: nil } } }.to_json })
end
notification.deliver
end
end
context 'when app ids is set' do
let(:notification) { Hsquare::Notification.new(recipient_id: recipient_id, message: message, app_ids: [:not_exist]) }
it do
Hsquare.config.applications.each do |application|
expect(application.admin_client).not_to receive(:post).with('/v1/push/send', body: { uuids: [recipient_id].to_json, push_message: { for_apns: { push_alert: true, message: message }, for_gcm: { delay_while_idle: false, custom_field: { message: message } } }.to_json })
end
notification.deliver
end
end
end
describe '#recipient_id=' do
let(:recipient_id) { 123 }
let(:notification) { Hsquare::Notification.new }
it { expect { notification.recipient_id = recipient_id }.to change { notification.recipient_ids }.to([recipient_id]) }
end
end
|
inbeom/hsquare
|
spec/lib/hsquare/notification_spec.rb
|
Ruby
|
mit
| 2,106
|
function Usage
{
Write-Host "Usage :"
Write-Host ""
Write-Host " CreateQueue.ps1 <-c,d> <queuename> <Y/N - Private> <user> <all:restrictedPermission> [T:Transactional]"
Write-Host ""
exit;
}
$opeartion = $Args[0]
$queuename = ".\" + $Args[1]
$private = $Args[2]
$User = $Args[3]
$permission = $Args[4]
$pTransactional = $Args[5]
if($opeartion -eq $null)
{
Usage;
}
if(($opeartion -ieq "-c") -and (($queuename -eq ".\") -or ($User -eq $null) -or ($private -eq $null) -or ($permission -eq $null)))
{
Usage;
}
elseif(($opeartion -ieq "-d") -and (($queuename -eq ".\") -or ($private -eq $null) ))
{
write-host "Cannot delete queue without queuename."
Usage;
}
[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
if ($private -ieq "Y")
{
$queuename = ".\private$\" + $Args[1]
}
if ($opeartion -ieq "-c")
{
if ($pTransactional -ieq "T")
{
$transactional = 1
Write-Host "Creating transactional queue " $queuename
}
else
{
$transactional = 0
Write-Host "Creating non-transactional queue " $queuename
}
if([System.Messaging.MessageQueue]::Exists($queuename))
{
Write-Host $queuename " already exists"
exit
}
$qb = [System.Messaging.MessageQueue]::Create($queuename, $transactional)
if($qb -eq $null -or $User -eq "")
{
exit
}
$qb.label = $queuename
if ($permission -ieq "all")
{
Write-Host "Granting all permissions to " $User
$qb.SetPermissions($User, [System.Messaging.MessageQueueAccessRights]::FullControl, [System.Messaging.AccessControlEntryType]::Allow)
}
else
{
Write-Host "Restricted Control for user: " $User
Write-Host ""
$qb.SetPermissions($User, [System.Messaging.MessageQueueAccessRights]::DeleteMessage, [System.Messaging.AccessControlEntryType]::Set)
$qb.SetPermissions($User, [System.Messaging.MessageQueueAccessRights]::GenericWrite, [System.Messaging.AccessControlEntryType]::Allow)
$qb.SetPermissions($User, [System.Messaging.MessageQueueAccessRights]::PeekMessage, [System.Messaging.AccessControlEntryType]::Allow)
$qb.SetPermissions($User, [System.Messaging.MessageQueueAccessRights]::ReceiveJournalMessage, [System.Messaging.AccessControlEntryType]::Allow)
}
}
elseif ($opeartion -ieq "-d")
{
Write-Host "Delete Queue: " + $queuename
[System.Messaging.MessageQueue]::Delete($queuename)
}
|
lholman/AutoBot
|
lib/psake/CreateQueue.ps1
|
PowerShell
|
mit
| 2,409
|
---
name: r-bloggers
layout: post
title: R-bloggers
author: Scott Chamberlain
date: 2011-01-05 08:11:00 -06:00
sourceslug: _posts/2011-01-05-r-bloggers.md
tags:
- R
---
Just a quick FYI note in case you haven't seen this site.
R-bloggers is an awesome site, bringing together more than 140 blogs (including mine) about R in a single location. See Tal Galili's motivation for creating the site, and his notes on the site [here][].
[here]: http://www.r-bloggers.com/r-bloggers-in-2010-top-14-r-posts-site-statistics-and-invitation-for-sponsors/
|
sckott/sckott.github.com
|
_posts/2011-01-05-r-bloggers.md
|
Markdown
|
mit
| 548
|
*{
margin: 0;
padding: 0;
}
body{
font-family: "open sans",sans-serif;
font-size: 14px;
line-height: 1.4em;
min-width: 600px;
}
.adminMenuWarp{
position:relative;
float:left;
width:160px;
background-color: #222222;
}
.adminmenu{
clear:left;
margin:12px 0;
list-style: none;
width:160px;
background-color: #222222;
}
.menu{
min-height:34px;
cursor: pointer;
}
.menu a {
padding: 10px 0;
display: block;
color: #ffffff;
text-decoration: none;
text-indent:40px;
}
a:hover {
background-color: #000000;
color:cyan;
}
|
nail2008/cookbook-angularjs
|
app/jk-vedio/cj_proj04_nav/Wp.css
|
CSS
|
mit
| 613
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RPG_Game_Binding_of_ROB.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
|
prorobbert/RPG_Game
|
Programma/RPG_Game_Binding_of_ROB/RPG_Game_Binding_of_ROB/Properties/Settings.Designer.cs
|
C#
|
mit
| 1,080
|
In this folder the screenshot for snip feature is stored
|
dreitagebart/crispy-fish
|
assets/scr/README.md
|
Markdown
|
mit
| 56
|
#2015年10月8日
##querySelector和querySelectorAll
```js
document.querySelector("body");//放回body节点
document.querySelector("#k");//返回id为k的节点
document.querySelector("#k span");//返回id为k的节点下的第一个span节点
document.querySelector("#k").querySelector("span");//返回id为k的节点下的第一个span节点
document.querySelectorAll("li");//返回所用tagName为li的节点集合(NodeList)
document.querySelectorAll("div .li");//返回class为li的div
```
>querySelectorAll 方法接收的参数是一个 **CSS 选择符**。而 getElementsBy 系列接收的参数只能是单一的*className*、*tagName* 和*name*。
querySelectorAll比较耗费性能。
|
Niefee/My-study-records
|
2015/10/2015年10月8日.markdown
|
Markdown
|
mit
| 701
|
//
// UIColor+HexString.h
// seanYang
//
// Created by yang on 16/5/26.
// Copyright © 2016年 yangshiyu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HexString)
+(UIColor *)colorWithHexString:(NSString *) hexString;
@end
|
yanghl/seanYang
|
seanYang/UIColor+HexString.h
|
C
|
mit
| 254
|
<?php
class DBUserRegistrator extends DBPlayerGlobalInfo
{
private static $queries = array(
'addNewUser' => 'INSERT INTO `players`(`login`, `password`, `email`) VALUES(:login,:password, :email)'
);
public static function register ($login, $password, $email = ''){
$state = true;
$message = '';
if (!InputValidator::validateLogin($login)){
$state = false;
$message.= InputValidator::LOGIN_REQUIREMENTS;
}
if (!InputValidator::validatePassword($password)){
$state = false;
$message.= ' ' . InputValidator::PASSWORD_REQUIREMENTS;
}
if (!InputValidator::validateEmail($email)){
$email = null;
}
if (!$state) {
return array(
'state' => $state,
'message' => $message
);
}
if (parent::checkUserExistence($login, $email)){
$state = false;
$message= 'Пользователь с таким именем или электронной почтой уже зарегистрирован';
return array(
'state' => $state,
'message' => $message
);
}
$hash = password_hash($password, PASSWORD_DEFAULT);
$playerId = self::addNewPlayerToDB($login, $hash, $email);
if ($playerId !== null){
$state = true;
$message = 'Вы успешно зарегистрированы!';
Authorization::logIn($playerId);
return array(
'state' => $state,
'message' => $message
);
} else {
$state = false;
$message= 'Ошибка при регистрации в базе данных приложения!';
return array(
'state' => $state,
'message' => $message
);
}
}
private static function addNewPlayerToDB($login, $hash, $email){
if (!defined('LOGIN_SCRIPT')) return null;
$email = empty($email) ? '' : $email;
try {
$stmt = parent::getConnection()->prepare(self::$queries['addNewUser']);
$stmt->bindParam(':login', $login);
$stmt->bindParam(':password', $hash);
$stmt->bindParam(':email', $email);
if (!$stmt->execute()){
ErrorLogger::logFailedDBRequest($stmt->errorInfo(), $stmt->queryString,__LINE__, __FILE__);
$message = 'Ошибка запроса к базе данных (Логин игрока: ' . $login . ', хэш: ' . $hash. ', email: ' . $email . ')';
throw new Exception($message);
}
$playerId = parent::getConnection()->lastInsertId();
} catch (Throwable $e){
ErrorLogger::logException($e);
return null;
}
return $playerId;
}
}
|
Ghivan/wordsgames
|
login/server_scenarios/_includes/classes/DBUserRegistrator.php
|
PHP
|
mit
| 3,060
|
---
layout: default
title: Linux(CentOS)时间设置及同步
category: Linux
---
一、时区
显示时区
date --help 获取帮助
date -R
date +%z
上面两个命令都可
[root@localhost ~]# date -R; date +%z
Fri, 19 Oct 2012 23:34:27 +0800
+0800
主要就是后面的+0800,东八区
修改时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
时区的信息存在/usr/share/zoneinfo/下面,本机的时区信息存在/etc/localtime,利用tab键技巧,可以任意修改时区
tzselect,互动式命令,不过用了好象不太行,还是用上面的吧。
二、时间
概念:Linux时间有两个
系统时间:也叫软件时间(sys), 1970年1月1日到当前时间的秒数
BOIS时间:也叫硬件时间(hc)
显示时间
[root@localhost ~]# date;hwclock -r
2012年 10月 19日 星期五 23:39:44 CST
2012年10月19日 星期五 23时39分45秒 -0.317993 seconds
设置时间
1、date -s
date -s 20121019
date -s 23:40:00
没有网络的情况下可以用这个
2、ntpdate
ntpdate time.windows.com && hwclock -w
连网更新时间,如果成功,将系统时间,写入BOIS
hwclock -w 或 hwclock --systohc
可以做到crontab里
3、启动ntpd服务,开启后2就不能用了。
先用ntpdate更新一下,确保时间不至于差别太大
rpm -qa | grep ntp #查询一下可安装了
chkconfig --list | grep ntp #看下服务情况
chkconifg ntpd on
service ntpd start 或/etc/init.d/ntpd start
必要的话,设置一下/etc/ntp.conf,再把服务reload一下。
获取当前时间:date
更改系统时间:date -s dd/mm/yyyy
同步: ntpdate cn.pool.ntp.org
http://support.ntp.org/bin/view/Servers/WebHome
See also
NTP(Network Time Protocol):https://en.wikipedia.org/wiki/NTP
UTC(Coordinated Universal Time): https://en.wikipedia.org/wiki/Coordinated_Universal_Time
|
klotski/klotski.github.io
|
_posts/1970-01-01-Linux_Time_Setting_and_Sync.md
|
Markdown
|
mit
| 1,857
|
/*
Copyright 2013, KISSY UI Library v1.40dev
MIT Licensed
build time: Aug 14 23:54
*/
KISSY.add("editor/plugin/dent-cmd",function(m,q,r){function s(c){return c.nodeType==k.NodeType.ELEMENT_NODE&&"li"==k.nodeName(c)}function v(c,d,e){for(var f=c.startContainer,a=c.endContainer;f&&!f.parent().equals(d);)f=f.parent();for(;a&&!a.parent().equals(d);)a=a.parent();if(f&&a){for(var b=f,f=[],i=!1;!i;)b.equals(a)&&(i=!0),f.push(b),b=b.next();if(!(1>f.length)){var g=d._4e_parents(!0,void 0);g.each(function(a,b){g[b]=a});for(a=0;a<g.length;a++)if(n[g[a].nodeName()]){d=g[a];break}for(var b="indent"==
e?1:-1,a=f[0],i=f[f.length-1],f={},h=r.listToArray(d,f),o=h[i.data("listarray_index")].indent,a=a.data("listarray_index");a<=i.data("listarray_index");a++){h[a].indent+=b;var m=h[a].parent;h[a].parent=new t(m[0].ownerDocument.createElement(m.nodeName()))}for(a=i.data("listarray_index")+1;a<h.length&&h[a].indent>o;a++)h[a].indent+=b;i=r.arrayToList(h,f,null,"p");b=[];if("outdent"==e){var l;if((l=d.parent())&&"li"==l.nodeName())for(var e=i.listNode.childNodes,j,a=e.length-1;0<=a;a--)(j=new t(e[a]))&&
"li"==j.nodeName()&&b.push(j)}i&&(k.insertBefore(i.listNode[0]||i.listNode,d[0]||d),d.remove());if(b&&b.length)for(a=0;a<b.length;a++){for(j=d=b[a];(j=j.next())&&j.nodeName()in n;)w.ie&&!d.first(function(a){return x(a)&&y(a)},1)&&d[0].appendChild(c.document.createTextNode("\u00a0")),d[0].appendChild(j[0]);k.insertAfter(d[0],l[0])}q.Utils.clearAllMarkers(f)}}}function u(c,d){var e=parseInt(c.style(l),10);isNaN(e)&&(e=0);e+=("indent"==d?1:-1)*p;if(0>e)return!1;e=Math.max(e,0);e=Math.ceil(e/p)*p;c.css(l,
e?e+z:"");""===c[0].style.cssText&&c.removeAttr("style");return!0}var n={ol:1,ul:1},o=q.Walker,k=m.DOM,t=m.Node,w=m.UA,x=o.whitespaces(!0),l="margin-left",p=40,z="px",y=o.bookmark(!1,!0);return{checkOutdentActive:function(c){var d=c.blockLimit;return c.contains(n)?!0:(c=c.block||d)&&c.style(l)},addCommand:function(c,d){c.hasCommand(d)||c.addCommand(d,{exec:function(e){e.execCommand("save");var f=e.getSelection(),a=f&&f.getRanges()[0];if(a){for(var b=a.startContainer,c=a.endContainer,g=a.getCommonAncestor();g&&
!(g[0].nodeType==k.NodeType.ELEMENT_NODE&&n[g.nodeName()]);)g=g.parent();g&&b[0].nodeType==k.NodeType.ELEMENT_NODE&&b.nodeName()in n&&(b=new o(a),b.evaluator=s,a.startContainer=b.next());g&&c[0].nodeType==k.NodeType.ELEMENT_NODE&&c.nodeName()in n&&(b=new o(a),b.evaluator=s,a.endContainer=b.previous());c=f.createBookmarks(!0);if(g){for(b=g.first();b&&"li"!=b.nodeName();)b=b.next();var h=a.startContainer;(!(b[0]==h[0]||b.contains(h))||!u(g,d))&&v(a,g,d)}else{a=a.createIterator();a.enforceRealBlocks=
!0;for(a.enlargeBr=!0;g=a.getNextParagraph();)u(g,d)}f.selectBookmarks(c)}e.execCommand("save");e.notifySelectionChange()}})}}},{requires:["editor","./list-utils"]});
|
jayli/kissy
|
build/editor/plugin/dent-cmd-min.js
|
JavaScript
|
mit
| 2,792
|
import rinocloud
import requests
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
from clint.textui.progress import Bar as ProgressBar
from clint.textui import progress
import json
def upload(filepath=None, meta=None):
encoder = MultipartEncoder(
fields={
'file': ('file', open(filepath, 'rb')),
'json': json.dumps(meta)
}
)
encoder_len = encoder.len
bar = ProgressBar(expected_size=encoder_len, filled_char='#')
def callback(monitor):
bar.show(monitor.bytes_read)
m = MultipartEncoderMonitor(encoder, callback)
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': m.content_type
}
try:
return requests.post(rinocloud.urls["upload"], data=m, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
def upload_meta(meta):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
try:
return requests.post(rinocloud.urls["upload_meta"], json=meta, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
def create_folder(meta):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
try:
return requests.post(rinocloud.urls["create_folder"], json=meta, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
def get_metadata(_id, truncate_metadata=True):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
try:
return requests.post(rinocloud.urls["get_metadata"], json={'id': _id, 'truncate_metadata': truncate_metadata}, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
def download(_id, filepath, size):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
try:
r = requests.get(rinocloud.urls["download"] + str(_id), stream=True, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
with open(filepath, 'wb') as f:
total_length = size
for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length / 1024) + 1):
if chunk:
f.write(chunk)
f.flush()
return r
def query(query, sort=None, truncate_metadata=True, limit=20, offset=0):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
payload = {
'query': query,
'truncate_metadata': truncate_metadata,
'limit': limit,
'offset': offset
}
if sort:
payload["sort"] = sort
try:
return requests.post(rinocloud.urls["query"], json=payload, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
def count(query):
headers = {
'Authorization': 'Token %s' % rinocloud.api_key,
'X-Requested-With': 'XMLHttpRequest'
}
try:
return requests.post(rinocloud.urls["count"], json={'query': query}, headers=headers)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("Could not connect to specified domain %s" % rinocloud.api_domain)
|
rinocloud/rinocloud-python
|
rinocloud/http.py
|
Python
|
mit
| 4,102
|
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Stockfighter.Client.Data
{
/// <summary>
/// An enum that represents buy/sell
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum Direction
{
Buy,
Sell
}
}
|
aaronmell/NetStockfighter
|
Stockfighter.Client/Data/Direction.cs
|
C#
|
mit
| 292
|
import os
import json
import pytest
from .. import bot, PACKAGEDIR
EXAMPLE_TWEET = json.load(open(os.path.join(PACKAGEDIR, 'tests', 'examples', 'example-tweet.json'), 'r'))
EXAMPLE_RETWEET = json.load(open(os.path.join(PACKAGEDIR, 'tests', 'examples', 'retweeted-status.json'), 'r'))
EXAMPLE_NARCISSISTIC = json.load(open(os.path.join(PACKAGEDIR, 'tests', 'examples', 'narcissistic-tweet.json'), 'r'))
TESTDB = 'test_goldstar.db'
def test_recipients():
handler = bot.TweetHandler(EXAMPLE_TWEET, dbfile=TESTDB, dry_run=True)
recipients = handler.get_recipients()
assert len(recipients) == 1
assert recipients[0]['screen_name'] == 'exoplaneteer'
def test_responses():
handler = bot.TweetHandler(EXAMPLE_TWEET, dbfile=TESTDB, dry_run=True)
responses = handler.handle()
assert len(responses) == 1 # only 1 star handed out
assert len(responses[0]) < 140 # max tweet length
assert responses[0] == '@exoplaneteer Congratulations, you just earned a 🌟 from @GeertHub! Your total is 1. https://twitter.com/GeertHub/status/745616020581265408'
def test_retweet():
"""A retweet should not result in a star!"""
with pytest.raises(bot.InvalidTweetException):
handler = bot.TweetHandler(EXAMPLE_RETWEET, dbfile=TESTDB, dry_run=True)
def test_narcisstic():
"""Don't allow people to give stars to themselves!"""
handler = bot.TweetHandler(EXAMPLE_NARCISSISTIC, dbfile=TESTDB, dry_run=True)
responses = handler.handle()
assert len(responses) == 1
assert responses[0] == "@exoplaneteer I'm sorry, Dan. I'm afraid I can't do that."
|
mrtommyb/AstroFuckOffs
|
bot/tests/test_bot.py
|
Python
|
mit
| 1,600
|
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="Q_REPLACE_CAMELCASED" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="Q_REPLACE_CAMELCASED" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="Q_REPLACE_CAMELCASED" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="Q_REPLACE_CAMELCASED" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Q_REPLACE_HUMAN</title>
<meta name="description" content="Q_REPLACE_HUMAN">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- alquimia --><!-- end:alquimia -->
<!-- inject:analytics --><!-- endinject -->
</head>
<body>
<main>
<h1>Welcome to Q_REPLACE_HUMAN!</h1>
</main>
</body>
</html>
|
AlquimiaWRG/alquimia-wa
|
app/index.html
|
HTML
|
mit
| 877
|
import _isArray from "./internal/is_array";
/**
* Returns `true` if the argument is an atom; `false` otherwise. An atom is defined as any
* value that is not an array, `undefined`, or `null`.
*
* @func
* @memberOf R
* @category Array
* @sig a -> Boolean
* @param {*} x The element to consider.
* @return {boolean} `true` if `x` is an atom, and `false` otherwise.
* @example
*
* ramda.isAtom([]); //=> false
* ramda.isAtom(null); //=> false
* ramda.isAtom(undefined); //=> false
*
* ramda.isAtom(0); //=> true
* ramda.isAtom(''); //=> true
* ramda.isAtom('test'); //=> true
* ramda.isAtom({}); //=> true
*/
export default function(x) {
return x != null && !_isArray(x);
};
|
markprzepiora/eigensheep
|
eigensheep/is_atom.js
|
JavaScript
|
mit
| 732
|
<?php
/**
* Created by PhpStorm.
* User: stefan
* Date: 28.05.15
* Time: 17:22
*/
namespace Structure\Classes;
use Structure\Classes\AbstractStructure;
use Request\Classes\Request\Post;
use Structure\Interfaces\Value;
use Structure\Classes\Form\Input\Hidden;
/**
* Class Form
* @package Structure\Classes
*/
class Form extends AbstractStructure
{
const METHOD_POST = 'post';
const METHOD_GET = 'get';
/**
* @var array
*/
protected $fields = array();
/**
* @var null
*/
protected $identifier = NULL;
/**
* @param AbstractStructure $structure
* @return $this
*/
public function add(AbstractStructure $structure)
{
$this->fields[] = $structure;
return $this;
}
/**
* @return array
*/
public function get_fields()
{
return $this->fields;
}
/**
* @return string
*/
public function get_fields_html()
{
$fields_html = '';
foreach ($this->get_fields() as $field)
{
$field->set_renderer($this->get_renderer());
$fields_html .= $field->get_renderer()->render($field);
}
return $fields_html;
}
/**
* @param $identifier
*/
public function init($identifier)
{
$this->identifier = $identifier;
$this->add(Hidden::factory($this->identifier.'_ds','1'));
}
/**
* @param $post_data
* @return bool
*/
public function is_submitted($post_data)
{
return isset($post_data[$this->identifier.'_ds']);
}
/**
* @param Post $post
* @return $this
*/
public function validate(Post $post)
{
if ($this->is_submitted($post)) {
foreach ($this->get_fields() as $field) {
if ($field instanceof Value) {
$field->validate($post);
}
}
}
return $this;
}
public function get_value_of($field_name)
{
$value = NULL;
foreach ($this->get_fields() as $field) {
if ($field instanceof Value)
{
$value = $field->get_value_of($field_name);
if (isset($value))
{
break;
}
}
}
return $value;
}
/**
* @return string
*/
public function get_html()
{
return '<form'.$this->get_attributes_html().'>'.$this->get_fields_html().'</form>';
}
}
|
StefftheEmperor/3rei
|
Structure/Classes/Form.php
|
PHP
|
mit
| 2,078
|
---
title: "Aleksandr Neudachin"
permalink: /alumni/Aleksandr_Neudachin
author_profile: false
comments: false
sidebar: false
---
<div style="padding: 20px;">
<img src="https://raw.githubusercontent.com/pyneng/pyneng.github.io/master/alumni/Aleksandr_Neudachin.png" alt="Python for network engineers">
</div>
|
pyneng/pyneng.github.io
|
_certificates/Aleksandr_Neudachin.md
|
Markdown
|
mit
| 312
|
/* nobleNote, a note taking application
* Copyright (C) 2012 Christian Metscher <hakaishi@web.de>,
Fabian Deuchler <Taiko000@gmail.com>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* nobleNote is licensed under the MIT, see `http://copyfree.org/licenses/mit/license.txt'.
*/
#ifndef LINEEDIT_H
#define LINEEDIT_H
#include <QLineEdit>
/**
* a line edit with a clear text button
*
*/
class QToolButton;
class LineEdit : public QLineEdit
{
Q_OBJECT
public:
LineEdit(QWidget *parent = 0);
protected:
void resizeEvent(QResizeEvent *);
private slots:
void updateCloseButton(const QString &text);
signals:
void sendCleared();
private:
QToolButton *clearButton;
};
#endif //LINEEDIT_H
|
taiko000/ThaiDictionary
|
lineedit.h
|
C
|
mit
| 1,767
|
#! /bin/bash
#SBATCH -o /home/hpc/pr63qi/di69fol/workspace/sweet/benchmarks_plane/sl-rexi/unstablejet_simtime10d_swefullnl_viscdiv0/job_bench_RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000/output.out
#SBATCH -e /home/hpc/pr63qi/di69fol/workspace/sweet/benchmarks_plane/sl-rexi/unstablejet_simtime10d_swefullnl_viscdiv0/job_bench_RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000/output.err
#SBATCH -D /home/hpc/pr63qi/di69fol/workspace/sweet/benchmarks_plane/sl-rexi/unstablejet_simtime10d_swefullnl_viscdiv0/job_bench_RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000
#SBATCH -J RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000
#SBATCH --get-user-env
#SBATCH --clusters=mpp2
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=28
# the above is a good match for the
# CooLMUC2 architecture.
#SBATCH --mail-type=end
#SBATCH --mail-user=schreiberx@gmail.com
#SBATCH --export=NONE
#SBATCH --time=48:00:00
source /etc/profile.d/modules.sh
export OMP_NUM_THREADS=28
# %SCRIPT_HEADER%
# Loading Job environment variables for currently active platform
cd "/home/hpc/pr63qi/di69fol/workspace/sweet"
source ./local_software/env_vars.sh "coolmuc_mpp2_gnu" || exit 1
export MPICC=mpigcc
export MPICXX=mpigxx
export MPIF90=mpifc
# chdir to execution directory
cd "/home/hpc/pr63qi/di69fol/workspace/sweet/benchmarks_plane/sl-rexi/unstablejet_simtime10d_swefullnl_viscdiv0/job_bench_RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000"
# %SCRIPT_EXEC_PREFIX%
# mpiexec ... would be here without a line break
EXEC="/home/hpc/pr63qi/di69fol/workspace/sweet/build/swe_plane_COMP_plspec_pldeal_numa2_fft_gnu_thomp_release"
PARAMS=" -G 0 -g 9.80616 -H 10000 -f 0.00014584 -M 512 -N -1 --space-grid-use-c-staggering=0 -S 1 -X 40031555.89280872 -Y 40031555.89280872 --benchmark-name=unstablejet -v 3 --dt=225.0 -o 864000 -u 0.0 -t 864000 --instability-checks=0 -d 12 --timestepping-method=l_rexi_na_sl_nd_settls --timestepping-order=2 --timestepping-order2=2 --rexi-method=direct --use-robert-functions=1 --compute-error=1 --reuse-plans=-1"
echo "${EXEC} ${PARAMS}"
mpiexec -n 1 --perhost 1 $EXEC $PARAMS || exit 1
# %SCRIPT_EXEC_SUFFIX%
# %SCRIPT_FOOTER%
return 2>/dev/null; exit 0
|
schreiberx/sweet
|
benchmarks_plane/sl-rexi/unstablejet_simtime10d_swefullnl_viscdiv0/job_bench_RT_tsm_l_rexi_na_sl_nd_settls_tso2_tsob2_C2.250e+02_S864000/run.sh
|
Shell
|
mit
| 2,222
|
---
layout: page
title: About GEVI
permalink: /about/
tags: about
---
|
gpernelle/gpernelle.github.io
|
_draft/about.md
|
Markdown
|
mit
| 70
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- Responsive Meta Data -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Core Meta Data -->
<meta name="author" content="@italowaxman, @robsongajunior, @jaydson">
<meta name="description" content="A collaborative website about the latest JavaScript features and tools.">
<meta name="keywords" content="javascript, JS, ECMAScript, ES6, Harmonic, front-end">
<!-- Facebook Tags -->
<meta property="og:description" content="A collaborative website about the latest JavaScript features and tools.">
<meta property="og:image" content="http://jsrocks.org/images/thumb.png">
<meta property="og:site_name" content="JS Rocks">
<meta property="og:title" content="JS Rocks">
<meta property="og:type" content="website">
<meta property="og:url" content="http://jsrocks.org">
<!-- Twitter tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="http://jsrocks.org">
<meta name="twitter:creator" content="@es6rocks">
<meta name="twitter:title" content="JS Rocks">
<meta name="twitter:description" content="A collaborative website about the latest JavaScript features and tools.">
<meta name="twitter:image" content="http://jsrocks.org/images/thumb.png">
<!-- Humans -->
<link rel="author" href="/AUTHORS" />
<!-- Favicon -->
<link rel="shortcut icon" href="http://jsrocks.org/favicon.ico">
<link rel="apple-touch-icon image_src" href="http://jsrocks.org/favicon.png">
<link rel="stylesheet" href="/css/vendor/prism.css"/>
<link rel="stylesheet" href="/css/vendor/normalize.css">
<link rel="stylesheet" href="/css/vendor/bootstrap.css">
<link rel="stylesheet" href="/css/vendor/bootstrap-theme.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/responsive.css">
<link rel="stylesheet" href="/css/animations.css">
<title>JS Rocks</title>
</head>
<body>
<div class="wrapper">
<header>
<div class="container">
<div class="row row-down">
<div class="col-sm-2 col-xs-12 flags-list">
<div>
<a class="item-flag" href="/">
<img src="/images/flag-en.png">
</a>
<a class="item-flag" href="/pt-br">
<img src="/images/flag-pt-br.png">
</a>
<a class="item-flag" href="/cn">
<img src="/images/flag-cn.png">
</a>
</div>
</div>
<div class="col-sm-8 col-xs-12 txt-header">
<span>A collaborative site about the Javascript, ES6, Harmonic and others.</span>
</div>
<div class="col-sm-2 col-xs-12 social-list">
<div class="right">
<a href="https://twitter.com/es6rocks" target="_blank" class="item-social"><img src="/images/icon-twitter-header.png" alt="icon twitter" title="Twitter"></a>
<a href="https://github.com/JSRocksHQ" target="_blank" class="item-social"><img src="/images/icon-github-header.png" alt="icon github" title="Github"></a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5 hidden-xs main-menu">
<nav>
<ul class="right">
<li class="item-main-menu">
<div class="thunder">
<svg version="1.1" class="" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="17.191px" height="29.535px" viewBox="0 0 17.191 29.535" enable-background="new 0 0 17.191 29.535" xml:space="preserve">
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#FCCF0F" points="17.191,0 1.438,15.457 6.365,15.466 0,29.535
17.166,12.907 11.773,12.661 "/>
</svg>
</div>
<a href="/">Posts</a>
</li>
<li class="item-main-menu">
<div class="thunder">
<svg version="1.1" class="" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="17.191px" height="29.535px" viewBox="0 0 17.191 29.535" enable-background="new 0 0 17.191 29.535" xml:space="preserve">
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#FCCF0F" points="17.191,0 1.438,15.457 6.365,15.466 0,29.535
17.166,12.907 11.773,12.661 "/>
</svg>
</div>
<a href="https://github.com/JSRocksHQ/jsrockshq.github.io/issues">Contact</a>
</li>
</ul>
</nav>
</div>
<div class="col-md-2 col-sm-12 col-xs-12 logo">
<a href="/" title="Return to posts">
<svg version="1.1" class="logo-svg" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="142.177px" height="155.783px" viewBox="0 0 142.177 155.783" enable-background="new 0 0 142.177 155.783"
xml:space="preserve">
<path fill="#FECF0A" d="M69.089,14.633c-26.213-0.08-48.162,10.428-55.916,26.771C6.558,55.34,12.782,82.197,28.31,106.716
c13.359,21.099,29.479,34.229,42.066,34.267l-0.012,3.786l0.021-3.786c13.998,0.037,33.537-16.743,47.514-40.807
c13.439-23.144,17.551-45.979,10.469-58.175C118.763,25.457,95.493,14.714,69.089,14.633z"/>
<path fill="#010101" d="M69.108,7.062C39.517,6.971,15.446,18.891,6.298,38.168c-8.992,18.947,1.346,50.111,15.578,72.59
c14.959,23.62,33.076,37.75,48.471,37.797h0.012c19.461,0.051,41.201-22.357,54.113-44.588c11.76-20.251,20.688-48.16,10.469-65.76
C123.841,19.087,98.614,7.152,69.108,7.062z M117.894,100.176C103.919,124.24,84.38,141.02,70.38,140.983l-0.021,3.786l0.014-3.786
c-12.588-0.038-28.707-13.168-42.068-34.267C12.778,82.197,6.554,55.34,13.167,41.404c7.756-16.342,29.705-26.851,55.916-26.771
c26.406,0.081,49.674,10.823,59.279,27.368C135.444,54.198,131.335,77.033,117.894,100.176z"/>
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#010101" points="80.015,23.006 64.261,38.463 69.188,38.473 62.823,52.542
79.989,35.913 74.597,35.667 "/>
<line fill="none" stroke="#010101" stroke-width="0.25" stroke-miterlimit="10" x1="43.396" y1="60.623" x2="99.444" y2="60.623"/>
<g>
<g>
<path fill="#010101" d="M48.709,110.585c0-0.101,0.026-0.179,0.074-0.236c0.051-0.06,0.125-0.089,0.224-0.09h4.399
c0.468,0,0.902,0.092,1.311,0.272c0.412,0.181,0.764,0.427,1.072,0.736c0.302,0.311,0.541,0.673,0.716,1.089
c0.175,0.416,0.263,0.859,0.263,1.329c0,0.32-0.043,0.624-0.123,0.914c-0.088,0.287-0.207,0.559-0.356,0.81
c-0.147,0.251-0.327,0.48-0.533,0.684c-0.207,0.205-0.431,0.38-0.677,0.525l1.749,3.411c0.034,0.065,0.075,0.144,0.123,0.232
c0.048,0.09,0.077,0.167,0.077,0.234c0,0.074-0.026,0.132-0.073,0.171c-0.049,0.04-0.112,0.06-0.194,0.06h-2.336
c-0.077,0-0.144-0.022-0.207-0.07c-0.062-0.047-0.103-0.11-0.118-0.189l-1.655-3.222h-1.102v3.18c0,0.201-0.104,0.302-0.313,0.302
h-2.022c-0.09,0-0.164-0.023-0.218-0.072c-0.054-0.051-0.08-0.126-0.08-0.229V110.585z M54.039,113.714
c0-0.14-0.026-0.282-0.074-0.423c-0.05-0.143-0.122-0.271-0.213-0.389c-0.089-0.116-0.199-0.216-0.326-0.296
c-0.126-0.08-0.27-0.131-0.423-0.155c-0.125-0.009-0.244-0.017-0.358-0.023c-0.11-0.008-0.231-0.012-0.365-0.012h-0.936v2.588
h1.255c0.078,0,0.151-0.002,0.216-0.008c0.063-0.004,0.132-0.011,0.21-0.021c0.157-0.019,0.302-0.067,0.427-0.146
c0.126-0.076,0.237-0.173,0.32-0.289c0.088-0.114,0.153-0.244,0.198-0.387C54.015,114.01,54.039,113.864,54.039,113.714z"/>
<path fill="#010101" d="M56.984,115.505c0-0.499,0.062-0.977,0.183-1.436c0.125-0.458,0.296-0.888,0.525-1.29
c0.228-0.401,0.498-0.766,0.815-1.096c0.315-0.328,0.667-0.609,1.053-0.843c0.386-0.232,0.798-0.412,1.244-0.542
c0.442-0.129,0.902-0.194,1.385-0.194c0.476,0,0.94,0.065,1.381,0.194c0.446,0.13,0.86,0.31,1.248,0.542
c0.386,0.233,0.738,0.515,1.053,0.843c0.321,0.33,0.593,0.694,0.816,1.096c0.224,0.402,0.399,0.832,0.524,1.29
c0.125,0.459,0.19,0.937,0.19,1.436c0,0.498-0.065,0.976-0.19,1.434s-0.3,0.886-0.524,1.283c-0.224,0.396-0.496,0.76-0.816,1.086
c-0.315,0.325-0.667,0.606-1.053,0.842c-0.388,0.236-0.802,0.415-1.248,0.542c-0.441,0.128-0.906,0.191-1.381,0.191
c-0.482,0-0.943-0.063-1.385-0.191c-0.446-0.127-0.858-0.306-1.244-0.542c-0.386-0.235-0.738-0.517-1.053-0.842
c-0.317-0.326-0.587-0.689-0.815-1.086c-0.229-0.397-0.4-0.825-0.525-1.283C57.046,116.481,56.984,116.003,56.984,115.505z
M59.618,115.499c0,0.39,0.065,0.753,0.192,1.092c0.126,0.338,0.304,0.633,0.533,0.884c0.227,0.252,0.5,0.45,0.811,0.593
c0.313,0.144,0.66,0.215,1.035,0.215c0.375,0,0.724-0.071,1.037-0.215c0.313-0.143,0.587-0.341,0.815-0.593
c0.229-0.251,0.408-0.546,0.533-0.884c0.126-0.339,0.19-0.702,0.19-1.092c0-0.386-0.063-0.75-0.19-1.09
c-0.125-0.341-0.304-0.639-0.533-0.892c-0.228-0.252-0.501-0.453-0.815-0.599c-0.313-0.146-0.662-0.221-1.037-0.221
c-0.375,0-0.721,0.075-1.035,0.221c-0.311,0.146-0.583,0.347-0.811,0.599c-0.229,0.253-0.407,0.551-0.533,0.892
C59.684,114.749,59.618,115.113,59.618,115.499z"/>
<path fill="#010101" d="M75.955,111.022c0.074,0.047,0.134,0.108,0.169,0.183c0.037,0.076,0.028,0.165-0.021,0.268l-1.148,1.692
c-0.05,0.08-0.104,0.126-0.162,0.138c-0.056,0.011-0.125-0.008-0.207-0.06c-0.222-0.174-0.466-0.309-0.736-0.403
c-0.265-0.093-0.548-0.14-0.85-0.14c-0.373,0-0.714,0.073-1.025,0.219c-0.315,0.146-0.587,0.347-0.811,0.599
c-0.228,0.253-0.404,0.55-0.531,0.889c-0.127,0.338-0.19,0.699-0.19,1.085c0,0.385,0.063,0.746,0.19,1.081
c0.127,0.338,0.304,0.63,0.531,0.882c0.224,0.252,0.496,0.451,0.811,0.597c0.312,0.146,0.652,0.218,1.025,0.218
c0.302,0,0.587-0.048,0.857-0.145c0.274-0.096,0.519-0.231,0.746-0.405c0.078-0.052,0.148-0.072,0.201-0.064
c0.052,0.011,0.107,0.054,0.164,0.128l1.161,1.733c0.051,0.104,0.058,0.19,0.022,0.262c-0.035,0.07-0.093,0.128-0.17,0.177
c-0.427,0.295-0.887,0.524-1.379,0.687s-1.013,0.243-1.557,0.243c-0.481,0-0.941-0.063-1.386-0.19
c-0.44-0.128-0.852-0.307-1.239-0.543c-0.39-0.235-0.738-0.517-1.052-0.842c-0.317-0.326-0.589-0.689-0.816-1.086
c-0.226-0.397-0.401-0.825-0.522-1.283c-0.123-0.458-0.185-0.936-0.185-1.434c0-0.499,0.062-0.977,0.185-1.436
c0.121-0.458,0.296-0.888,0.522-1.29c0.228-0.401,0.5-0.766,0.816-1.096c0.313-0.328,0.662-0.609,1.052-0.843
c0.388-0.231,0.799-0.412,1.239-0.542c0.444-0.129,0.904-0.194,1.386-0.194c0.544,0,1.061,0.078,1.543,0.236
C75.071,110.499,75.527,110.726,75.955,111.022z"/>
<path fill="#010101" d="M77.002,110.57c0-0.085,0.026-0.157,0.079-0.217c0.054-0.062,0.125-0.094,0.222-0.094h2.008
c0.066,0,0.14,0.029,0.216,0.085c0.073,0.058,0.112,0.133,0.112,0.226v3.842c0.492-0.656,0.979-1.306,1.456-1.944
c0.477-0.64,0.96-1.288,1.45-1.945c0.048-0.081,0.113-0.145,0.191-0.195c0.079-0.048,0.159-0.074,0.233-0.074h2.588
c0.109,0,0.166,0.036,0.166,0.107c0,0.046-0.026,0.103-0.077,0.168l-3.204,4.378l3.544,5.527c0.052,0.079,0.078,0.142,0.078,0.188
c0,0.071-0.054,0.106-0.153,0.106h-2.57c-0.076,0-0.154-0.023-0.228-0.071c-0.078-0.045-0.138-0.11-0.188-0.189
c-0.24-0.338-0.458-0.663-0.656-0.972c-0.199-0.312-0.392-0.62-0.576-0.929c-0.186-0.306-0.374-0.618-0.564-0.934
c-0.19-0.313-0.398-0.646-0.625-0.994l-0.864,1.03v2.748c0,0.207-0.112,0.311-0.328,0.311h-2.003
c-0.203,0-0.306-0.104-0.306-0.311V110.57z"/>
<path fill="#010101" d="M87.878,117.344c0.079,0.066,0.178,0.154,0.297,0.265c0.121,0.111,0.257,0.22,0.412,0.328
c0.229,0.16,0.462,0.285,0.688,0.373c0.228,0.089,0.465,0.134,0.714,0.134c0.233,0,0.428-0.026,0.582-0.08
c0.158-0.055,0.283-0.126,0.373-0.215c0.089-0.091,0.154-0.192,0.191-0.312c0.038-0.116,0.06-0.24,0.06-0.372
c0-0.146-0.056-0.275-0.158-0.391c-0.109-0.115-0.238-0.218-0.394-0.307c-0.154-0.09-0.314-0.166-0.484-0.229
c-0.168-0.064-0.313-0.116-0.435-0.157c-0.546-0.199-1.021-0.411-1.43-0.638c-0.408-0.229-0.749-0.483-1.02-0.763
c-0.272-0.279-0.478-0.586-0.615-0.921c-0.136-0.338-0.203-0.71-0.203-1.124c0-0.437,0.086-0.834,0.257-1.19
c0.17-0.357,0.41-0.663,0.729-0.916c0.312-0.253,0.695-0.449,1.139-0.588c0.443-0.138,0.941-0.209,1.491-0.209
c0.412,0,0.808,0.049,1.186,0.146c0.381,0.097,0.752,0.25,1.119,0.463c0.154,0.093,0.3,0.19,0.439,0.291
c0.14,0.103,0.258,0.199,0.365,0.293c0.104,0.095,0.185,0.184,0.246,0.268c0.063,0.085,0.094,0.158,0.094,0.219
c0,0.062-0.013,0.119-0.043,0.169c-0.03,0.053-0.076,0.11-0.133,0.178l-1.042,1.147c-0.078,0.081-0.154,0.12-0.232,0.12
c-0.063,0-0.121-0.019-0.176-0.057c-0.05-0.037-0.107-0.084-0.171-0.141l-0.063-0.057c-0.088-0.08-0.19-0.162-0.301-0.246
c-0.107-0.085-0.229-0.162-0.354-0.229c-0.131-0.067-0.265-0.125-0.405-0.169c-0.14-0.045-0.283-0.067-0.431-0.067
c-0.15,0-0.287,0.013-0.423,0.039c-0.127,0.026-0.244,0.067-0.341,0.123c-0.103,0.057-0.183,0.131-0.24,0.222
c-0.061,0.094-0.09,0.203-0.09,0.336c0,0.132,0.031,0.245,0.095,0.341c0.063,0.097,0.159,0.187,0.287,0.269
c0.127,0.082,0.283,0.16,0.47,0.231c0.19,0.074,0.408,0.152,0.66,0.237c0.482,0.165,0.925,0.338,1.331,0.519
c0.404,0.18,0.755,0.395,1.052,0.641c0.292,0.245,0.523,0.542,0.689,0.885c0.166,0.344,0.248,0.759,0.248,1.247
c0,0.517-0.101,0.986-0.306,1.408c-0.203,0.419-0.483,0.777-0.841,1.073c-0.358,0.297-0.773,0.526-1.255,0.688
c-0.482,0.161-0.997,0.242-1.553,0.242c-0.522,0-1.034-0.097-1.538-0.29c-0.505-0.193-0.971-0.452-1.409-0.777
c-0.181-0.137-0.336-0.271-0.459-0.402c-0.125-0.132-0.224-0.238-0.296-0.318l-0.021-0.022c-0.006-0.008-0.01-0.015-0.014-0.017
c-0.003-0.002-0.009-0.006-0.015-0.011c-0.004-0.01-0.009-0.016-0.013-0.018c-0.004-0.003-0.01-0.005-0.015-0.011
c-0.104-0.117-0.155-0.213-0.155-0.283c0-0.079,0.051-0.169,0.155-0.269l1.18-1.163c0.093-0.071,0.172-0.104,0.228-0.104
c0.045,0,0.086,0.014,0.132,0.042C87.763,117.246,87.816,117.288,87.878,117.344z"/>
</g>
<g>
<path fill="#010101" d="M67.083,70.823h-6.708c-0.306,0.025-0.41,0.135-0.41,0.466v24.097c0,0.435-0.093,0.848-0.274,1.231
c-0.173,0.37-0.412,0.701-0.705,0.979c-0.292,0.273-0.634,0.494-1.018,0.659c-0.934,0.391-1.936,0.303-2.642-0.062
c-0.371-0.192-0.696-0.407-0.968-0.639l-0.684-0.577c-0.159-0.135-0.267-0.222-0.503-0.096c-0.104,0.053-0.2,0.118-0.296,0.206
l-3.952,3.832c-0.08,0.067-0.214,0.173-0.214,0.555c0,0.056,0,0.1,0.002,0.138c0.473,0.723,1.027,1.371,1.648,1.927
c0.628,0.559,1.316,1.037,2.045,1.421c0.727,0.38,1.508,0.671,2.321,0.867c2.172,0.521,4.51,0.34,6.54-0.541
c1.281-0.556,2.419-1.328,3.389-2.297c0.969-0.971,1.752-2.121,2.321-3.418c0.569-1.296,0.857-2.706,0.857-4.186V71.573
C67.832,71.019,67.636,70.823,67.083,70.823z"/>
<path fill="#010101" d="M93.346,91.202c-0.518-1.077-1.256-2.021-2.19-2.805c-0.948-0.793-2.095-1.492-3.409-2.078
c-1.343-0.597-2.828-1.176-4.413-1.72c-0.843-0.284-1.584-0.55-2.22-0.797c-0.656-0.253-1.22-0.53-1.671-0.823
c-0.475-0.306-0.846-0.654-1.096-1.035c-0.265-0.402-0.397-0.876-0.397-1.406c0-0.531,0.125-0.996,0.371-1.38
c0.24-0.372,0.565-0.674,0.966-0.9c0.375-0.213,0.812-0.369,1.301-0.466c0.94-0.185,2.062-0.219,3.088,0.106
c0.494,0.157,0.975,0.359,1.426,0.601c0.449,0.24,0.872,0.513,1.26,0.809c0.383,0.292,0.731,0.573,1.043,0.849l0.212,0.196
c0.194,0.169,0.371,0.316,0.535,0.435c0.095,0.066,0.192,0.099,0.304,0.099c0.153,0,0.319-0.139,0.433-0.256l3.477-3.835
c0.174-0.195,0.305-0.368,0.387-0.51c0.056-0.098,0.083-0.207,0.083-0.327c0-0.036-0.017-0.174-0.218-0.451
c-0.185-0.255-0.443-0.532-0.766-0.822c-0.336-0.304-0.733-0.623-1.181-0.95c-0.458-0.334-0.941-0.656-1.438-0.958
c-1.174-0.676-2.396-1.18-3.618-1.492c-1.227-0.311-2.526-0.469-3.86-0.469c-1.777,0-3.408,0.227-4.85,0.675
c-1.422,0.443-2.656,1.078-3.663,1.886c-0.991,0.799-1.767,1.775-2.304,2.899c-0.537,1.123-0.807,2.394-0.807,3.781
c0,1.312,0.218,2.519,0.649,3.583c0.429,1.06,1.084,2.047,1.95,2.935c0.874,0.897,1.987,1.727,3.31,2.465
c1.338,0.745,2.925,1.454,4.716,2.102c0.406,0.14,0.897,0.317,1.468,0.532c0.589,0.224,1.155,0.493,1.687,0.802
c0.554,0.318,1.031,0.694,1.421,1.114c0.439,0.471,0.665,1.021,0.665,1.633c0,0.474-0.072,0.942-0.216,1.394
c-0.156,0.472-0.416,0.885-0.773,1.234c-0.351,0.346-0.828,0.626-1.419,0.829c-1.191,0.411-3.113,0.431-4.674-0.184
c-0.784-0.309-1.592-0.747-2.399-1.303c-0.534-0.375-1.016-0.759-1.43-1.139c-0.398-0.365-0.725-0.657-0.979-0.875
c-0.192-0.17-0.353-0.298-0.486-0.38c-0.075-0.046-0.14-0.07-0.183-0.07c-0.006,0-0.144,0.002-0.488,0.259l-3.893,3.852
c-0.358,0.338-0.384,0.515-0.384,0.561c0,0.002,0.003,0.172,0.384,0.605c0.047,0.034,0.086,0.074,0.119,0.118
c0.04,0.035,0.075,0.073,0.104,0.118l0.028,0.027c0.257,0.283,0.585,0.636,1.001,1.074c0.399,0.425,0.896,0.861,1.476,1.297
c1.417,1.058,2.965,1.912,4.604,2.539c3.352,1.287,7.009,1.167,10.021,0.151c1.553-0.523,2.916-1.27,4.055-2.217
c1.136-0.945,2.042-2.104,2.69-3.441c0.648-1.334,0.979-2.85,0.979-4.501C94.131,93.612,93.866,92.277,93.346,91.202z"/>
</g>
</g>
</svg>
</a>
</div>
<div class="col-md-5 hidden-xs search">
<form id="s" method="GET" action="http://www.google.com/search">
<div class="icon-search">
<img class="icon-search-white" src="/images/icon-search-header-hover.png" alt="icon search">
</div>
<input type="text" class="input-search" placeholder="Search" name="q">
<input type="submit" class="button-search" value="OK">
</form>
<div class="popular-tags">
<span>Popular Searches:</span>
<ul class="list-tags"></ul>
</div>
</div>
</div>
<div class="row row-button">
<a href="https://github.com/JSRocksHQ/jsrockshq.github.io#writing-an-article" target="_blank" class="button-post">
<svg version="1.1" class="thunder-hover" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="17.191px" height="29.535px" viewBox="0 0 17.191 29.535" enable-background="new 0 0 17.191 29.535" xml:space="preserve">
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#FCCF0F" points="17.191,0 1.438,15.457 6.365,15.466 0,29.535
17.166,12.907 11.773,12.661 "/>
</svg>
<span>Send a Post</span>
</a>
<p class="info-button-post">*using github</p>
</div>
</div>
</header>
<div class="content">
<div class="container">
<section class="posts-list">
<div class="row">
<article class="col-sm-6 col-xs-12 post-big item-post post-fade-1">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2015/05/how-i-m-using-es6-modules-in-production" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2015/05/how-i-m-using-es6-modules-in-production" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Fri May 08 2015 04:51:30 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2015/05/how-i-m-using-es6-modules-in-production" alt="how I'm using es6 modules in production">how I'm using es6 modules in production</a></h1>
<div class="intro-post"> <p>I've been using <a href="/categories/modules/">ES6 modules</a> for a while in my daily work and I want to share with you guys how I'm doing it.<br>First of all, <a href="https://babeljs.io/">Babel</a> is the consolidated tool for transpilation. It's a very active project, and it covers almost all of modern JavaScript features.<br>Babel works great for modules too, so you'll just need to decide the flavour, I mean AMD, Common, UMD and even customized modules. </p>
</div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="modules">
<a href="/categories/modules">modules</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/453720347620032512/UM2nE21c_400x400.jpeg" alt="Jaydson Gomes"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/jaydson" class="author" alt="Author: Jaydson Gomes">Jaydson Gomes</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-sm-6 col-xs-12 post-big item-post post-fade-2">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2015/01/temporal-dead-zone-tdz-demystified" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2015/01/temporal-dead-zone-tdz-demystified" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Sat Jan 31 2015 18:19:51 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2015/01/temporal-dead-zone-tdz-demystified" alt="Temporal Dead Zone (TDZ) demystified">Temporal Dead Zone (TDZ) demystified</a></h1>
<div class="intro-post"> </div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="scope">
<a href="/categories/scope">scope</a>
</li>
<li class="item-tag-post" data-post-category=" articles">
<a href="/categories/articles"> articles</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/490627147963187200/2BiH3pv4.png" alt="Fabrício S. Matté"></div>
<div class="info-author">
<span>Posted by</span>
<a href="https://twitter.com/Ult_Combo" class="author" alt="Author: Fabrício S. Matté">Fabrício S. Matté</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-3">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/12/using-es6-modules-in-the-browser-with-gulp" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/12/using-es6-modules-in-the-browser-with-gulp" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Tue Dec 02 2014 17:14:37 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/12/using-es6-modules-in-the-browser-with-gulp" alt="Using ES6 modules in the browser with gulp">Using ES6 modules in the browser with gulp</a></h1>
<div class="intro-post"> </div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="modules">
<a href="/categories/modules">modules</a>
</li>
<li class="item-tag-post" data-post-category=" tutorial">
<a href="/categories/tutorial"> tutorial</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="http://juan.me/images/reacticabrera.jpg" alt="Juan Cabrera"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://juan.me" class="author" alt="Author: Juan Cabrera">Juan Cabrera</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-4">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/10/es6-modules-today-with-6to5" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/10/es6-modules-today-with-6to5" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Tue Oct 28 2014 12:49:54 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/10/es6-modules-today-with-6to5" alt="ES6 modules today with 6to5">ES6 modules today with 6to5</a></h1>
<div class="intro-post"> <p>I've posted the image below on <a href="https://twitter.com/jaydson/status/526882798263881730">Twitter</a> showing how happy I was.</p>
</div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="Modules">
<a href="/categories/modules">Modules</a>
</li>
<li class="item-tag-post" data-post-category=" Tutorial">
<a href="/categories/tutorial"> Tutorial</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/453720347620032512/UM2nE21c_400x400.jpeg" alt="Jaydson Gomes"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/jaydson" class="author" alt="Author: Jaydson Gomes">Jaydson Gomes</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-5">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/10/javascript-unicode" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/10/javascript-unicode" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Mon Oct 13 2014 19:22:32 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/10/javascript-unicode" alt="JavaScript ♥ Unicode">JavaScript ♥ Unicode</a></h1>
<div class="intro-post"> <p>Mathias Bynens gave an awesome talk in the last <a href="http://2014.jsconf.eu">JSConfEU</a> edition.</p>
</div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="Unicode">
<a href="/categories/unicode">Unicode</a>
</li>
<li class="item-tag-post" data-post-category=" Videos">
<a href="/categories/videos"> Videos</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/453720347620032512/UM2nE21c_400x400.jpeg" alt="Jaydson Gomes"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/jaydson" class="author" alt="Author: Jaydson Gomes">Jaydson Gomes</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-6">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/10/arrow-functions-and-their-scope" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/10/arrow-functions-and-their-scope" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Wed Oct 01 2014 04:01:41 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/10/arrow-functions-and-their-scope" alt="Arrow Functions and their scope">Arrow Functions and their scope</a></h1>
<div class="intro-post"> <p>Among so many great new features in ES6, Arrow Functions (or Fat Arrow Functions) is one that deserves attention!</p>
</div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="scope">
<a href="/categories/scope">scope</a>
</li>
<li class="item-tag-post" data-post-category=" articles">
<a href="/categories/articles"> articles</a>
</li>
<li class="item-tag-post" data-post-category=" basics">
<a href="/categories/basics"> basics</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="/avatars/felipenmoura.png" alt="Felipe N. Moura"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/felipenmoura" class="author" alt="Author: Felipe N. Moura">Felipe N. Moura</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-7">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/08/what-is-next-for-javascript" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/08/what-is-next-for-javascript" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Fri Aug 29 2014 03:04:03 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/08/what-is-next-for-javascript" alt="What's next for JavaScript">What's next for JavaScript</a></h1>
<div class="intro-post"> <p>If you're interested in ES6 you must follow <a href="https://twitter.com/rauschma">Dr. Axel Rauschmayer</a>.</p>
</div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="talks">
<a href="/categories/talks">talks</a>
</li>
<li class="item-tag-post" data-post-category=" videos">
<a href="/categories/videos"> videos</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/453720347620032512/UM2nE21c_400x400.jpeg" alt="Jaydson Gomes"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/jaydson" class="author" alt="Author: Jaydson Gomes">Jaydson Gomes</a>
</div>
</div>
</section>
</div>
</article>
<article class="col-md-4 col-sm-6 col-xs-12 post-normal item-post post-fade-8">
<div class="container-post">
<aside class="share-post">
<a href="#" data-provider="https://www.facebook.com/sharer.php?u=" data-post-url="/2014/08/what-you-need-to-know-about-block-scope-let" class="share-face share-item" title="Share this post"><img src="/images/icon-face-header.png" alt="icon facebook"></a>
<a href="#" data-provider="https://twitter.com/intent/tweet?url=" data-post-url="/2014/08/what-you-need-to-know-about-block-scope-let" class="share-twitter share-item" title="Tweet this post"><img src="/images/icon-twitter-header.png" alt="icon twitter"></a>
</aside>
<div class="date-post">Thu Aug 28 2014 01:58:23 GMT+0000 (UTC)</div>
<h1 class="title-post"><a href="/2014/08/what-you-need-to-know-about-block-scope-let" alt="What you need to know about block scope - let">What you need to know about block scope - let</a></h1>
<div class="intro-post"> </div>
<section class="footer-post">
<ul class="tags-post">
<li class="item-tag-post" data-post-category="scope">
<a href="/categories/scope">scope</a>
</li>
<li class="item-tag-post" data-post-category=" articles">
<a href="/categories/articles"> articles</a>
</li>
<li class="item-tag-post" data-post-category=" basics">
<a href="/categories/basics"> basics</a>
</li>
</ul>
<div class="author-post">
<div class="avatar-author"><img src="https://pbs.twimg.com/profile_images/453720347620032512/UM2nE21c_400x400.jpeg" alt="Jaydson Gomes"></div>
<div class="info-author">
<span>Posted by</span>
<a href="http://twitter.com/jaydson" class="author" alt="Author: Jaydson Gomes">Jaydson Gomes</a>
</div>
</div>
</section>
</div>
</article>
<div id="containerMorePosts">
<!-- More posts -->
</div>
</div>
<div class="row row-more-posts">
<div class="col-md-12 more-posts">
<button id="morePosts" class="button-post button-more-posts">
<img class="icon-more" src="/images/icon-button-more.png" alt="icon more posts">
<span>More Posts</span>
</button>
</div>
</div>
</section>
<section class="testemonials">
<div class="row">
<div class="col-md-12 title-testemonials">
<div class="centering">
<img class="icon-testemonials" src="/images/icon-title-testemonials.png" alt="icon testemonials">
<h2>TESTIMONIALS</h2>
</div>
</div>
</div>
<div class="row">
<div class="list-testemonials">
<div class="centering">
<div class="col-md-4 item-testemonial">
<div class="txt-testemonial">
<p>"ES6 improves developer ergonomics massively and jsrocks.org will help you grok the benefit you can reap and how to get it today. Love it."</p>
<div class="arrow-talk"></div>
</div>
<div class="author-testemonial">
<div class="avatar-testemonial"><img src="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/s720x720/10353036_813104195802_7941905438286773361_n.jpg?oh=beb6ae8c2592e1d4643d4c53dcb90e25&oe=55B79209&__gda__=1438435571_06f637521de054e10a57cba2798c1b41" alt="image testemonial"></div>
<div class="info-author">
<h3 class="author">Paul Irish</h3>
<div class="social-list">
<a href="http://twitter.com/paul_irish" class="item-social"><img src="/images/icon-twitter-header.png" alt="icon twitter" title="Twitter"></a>
<a href="http://github.com/paulirish" class="item-social"><img src="/images/icon-github-header.png" alt="icon github" title="Github"></a>
</div>
<span class="work-place">Google</span>
</div>
</div>
</div>
<div class="col-md-4 item-testemonial">
<div class="txt-testemonial">
<p>"JS Rocks is a brilliant initiative, if you're looking for relevant content about what's coming next for the JavaScript language, here's the place to find."</p>
<div class="arrow-talk"></div>
</div>
<div class="author-testemonial">
<div class="avatar-testemonial"><img src="https://scontent-gru.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/1508142_10201835389099369_665640594_n.jpg?oh=03481a872bcd57332f955db3ba063fdd&oe=55792D9F" alt="image testemonial"></div>
<div class="info-author">
<h3 class="author">Zeno Rocha</h3>
<div class="social-list">
<a href="http://twitter.com/zenorocha" class="item-social"><img src="/images/icon-twitter-header.png" alt="icon twitter" title="Twitter"></a>
<a href="http://github.com/zenorocha" class="item-social"><img src="/images/icon-github-header.png" alt="icon github" title="Github"></a>
</div>
<span class="work-place">Liferay</span>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-12 credits">
<div class="right">
<span class="created">Brought to you by <a href="http://jaydson.org/" target="_blank">Jaydson Gomes</a> and the <a href="https://github.com/JSRocksHQ/jsrockshq.github.io/graphs/contributors" targer="_blank">awesome contributors</a>.</span>
<span class="designed">Designed by <a href="https://www.linkedin.com/in/italowaxman" target="_blank">Ítalo Waxman</a></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 footer-content">
<div class="info-footer">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="136.478px" height="149.494px" viewBox="0 0 136.478 149.494" enable-background="new 0 0 136.478 149.494"
xml:space="preserve">
<path fill="#010101" d="M66.176,0C36.584-0.095,12.514,12.499,3.365,32.866c-8.992,20.019,1.346,52.944,15.578,76.694
c14.959,24.955,33.076,39.884,48.471,39.934h0.012c19.461,0.054,41.201-23.621,54.113-47.108
c11.76-21.396,20.688-50.884,10.469-69.479C120.908,12.706,95.682,0.096,66.176,0z M114.961,98.38
c-13.975,25.424-33.514,43.153-47.514,43.114l-0.021,4l0.014-4c-12.588-0.04-28.707-13.913-42.068-36.204
C9.846,79.384,3.621,51.008,10.234,36.285C17.99,19.018,39.939,7.916,66.15,8c26.406,0.085,49.674,11.435,59.279,28.915
C132.512,49.802,128.402,73.928,114.961,98.38z"/>
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#FECF0A" points="77.082,19.945 61.328,35.402 66.256,35.412 59.891,49.48
77.057,32.852 71.664,32.606 "/>
<line fill="none" stroke="#010101" stroke-width="0.25" stroke-miterlimit="10" x1="40.463" y1="57.562" x2="96.512" y2="57.562"/>
<g>
<g>
<path fill="#010101" d="M44.693,108.227c0-0.104,0.027-0.187,0.078-0.247c0.053-0.062,0.131-0.093,0.234-0.094h4.609
c0.49,0,0.945,0.096,1.373,0.285c0.432,0.189,0.801,0.447,1.123,0.771c0.316,0.325,0.566,0.705,0.75,1.141s0.275,0.9,0.275,1.393
c0,0.335-0.045,0.653-0.129,0.957c-0.092,0.302-0.217,0.586-0.373,0.849c-0.154,0.263-0.342,0.503-0.559,0.716
c-0.217,0.215-0.451,0.398-0.709,0.551l1.832,3.574c0.035,0.068,0.078,0.15,0.129,0.243c0.051,0.094,0.08,0.175,0.08,0.245
c0,0.078-0.027,0.139-0.076,0.18c-0.051,0.042-0.117,0.062-0.203,0.062h-2.447c-0.08,0-0.15-0.023-0.217-0.074
c-0.064-0.049-0.107-0.115-0.123-0.198l-1.734-3.375h-1.154v3.331c0,0.211-0.109,0.316-0.328,0.316h-2.119
c-0.094,0-0.172-0.025-0.229-0.076c-0.057-0.053-0.084-0.132-0.084-0.24V108.227z M50.277,111.505
c0-0.146-0.027-0.296-0.078-0.442c-0.053-0.149-0.127-0.284-0.223-0.407c-0.094-0.122-0.209-0.227-0.342-0.311
s-0.283-0.137-0.443-0.162c-0.131-0.01-0.256-0.018-0.375-0.025c-0.115-0.008-0.242-0.012-0.383-0.012h-0.98v2.711h1.314
c0.082,0,0.158-0.002,0.227-0.008c0.066-0.004,0.139-0.012,0.221-0.021c0.164-0.02,0.316-0.07,0.447-0.152
c0.133-0.08,0.248-0.182,0.336-0.303c0.092-0.12,0.16-0.256,0.207-0.405C50.252,111.815,50.277,111.662,50.277,111.505z"/>
<path fill="#010101" d="M53.363,113.382c0-0.523,0.064-1.023,0.191-1.504c0.131-0.48,0.311-0.931,0.551-1.352
c0.238-0.421,0.521-0.803,0.854-1.148c0.33-0.344,0.699-0.639,1.104-0.883c0.404-0.243,0.836-0.432,1.303-0.568
c0.463-0.135,0.945-0.203,1.451-0.203c0.498,0,0.984,0.068,1.447,0.203c0.467,0.137,0.9,0.325,1.307,0.568
c0.404,0.244,0.773,0.539,1.104,0.883c0.336,0.346,0.621,0.728,0.855,1.148s0.418,0.871,0.549,1.352s0.199,0.98,0.199,1.504
c0,0.521-0.068,1.021-0.199,1.502c-0.131,0.479-0.314,0.928-0.549,1.344s-0.52,0.796-0.855,1.138
c-0.33,0.341-0.699,0.636-1.104,0.883c-0.406,0.247-0.84,0.435-1.307,0.567c-0.463,0.134-0.949,0.2-1.447,0.2
c-0.506,0-0.988-0.066-1.451-0.2c-0.467-0.133-0.898-0.32-1.303-0.567s-0.773-0.542-1.104-0.883
c-0.332-0.342-0.615-0.722-0.854-1.138c-0.24-0.416-0.42-0.864-0.551-1.344C53.428,114.403,53.363,113.903,53.363,113.382z
M56.123,113.374c0,0.408,0.068,0.789,0.201,1.145c0.133,0.354,0.318,0.663,0.559,0.926c0.238,0.264,0.523,0.472,0.85,0.621
c0.328,0.15,0.691,0.225,1.084,0.225s0.758-0.074,1.086-0.225c0.328-0.149,0.615-0.357,0.854-0.621
c0.24-0.263,0.428-0.572,0.559-0.926c0.133-0.355,0.199-0.736,0.199-1.145c0-0.404-0.066-0.785-0.199-1.142
c-0.131-0.356-0.318-0.669-0.559-0.934c-0.238-0.265-0.525-0.476-0.854-0.628s-0.693-0.23-1.086-0.23s-0.756,0.078-1.084,0.23
c-0.326,0.152-0.611,0.363-0.85,0.628c-0.24,0.265-0.426,0.577-0.559,0.934S56.123,112.97,56.123,113.374z"/>
<path fill="#010101" d="M73.238,108.685c0.078,0.049,0.141,0.113,0.178,0.191c0.039,0.079,0.029,0.173-0.021,0.28l-1.203,1.772
c-0.053,0.084-0.109,0.133-0.17,0.145c-0.059,0.012-0.131-0.008-0.217-0.062c-0.232-0.182-0.488-0.323-0.771-0.422
c-0.277-0.098-0.574-0.146-0.891-0.146c-0.391,0-0.748,0.076-1.074,0.229c-0.33,0.152-0.615,0.363-0.85,0.628
c-0.238,0.265-0.424,0.575-0.557,0.931c-0.133,0.354-0.199,0.732-0.199,1.137c0,0.403,0.066,0.781,0.199,1.133
c0.133,0.354,0.318,0.66,0.557,0.924c0.234,0.264,0.52,0.473,0.85,0.625c0.326,0.152,0.684,0.229,1.074,0.229
c0.316,0,0.615-0.051,0.898-0.151c0.287-0.101,0.543-0.243,0.781-0.425c0.082-0.055,0.156-0.076,0.211-0.067
c0.055,0.011,0.113,0.056,0.172,0.134l1.217,1.816c0.053,0.108,0.061,0.199,0.023,0.273s-0.098,0.135-0.178,0.186
c-0.447,0.309-0.93,0.549-1.445,0.719s-1.061,0.255-1.631,0.255c-0.504,0-0.986-0.066-1.451-0.199
c-0.461-0.134-0.893-0.321-1.299-0.568c-0.408-0.247-0.773-0.542-1.102-0.883c-0.332-0.342-0.617-0.722-0.855-1.138
c-0.236-0.416-0.42-0.864-0.547-1.344c-0.129-0.48-0.193-0.98-0.193-1.502c0-0.523,0.064-1.023,0.193-1.504
c0.127-0.48,0.311-0.931,0.547-1.352c0.238-0.421,0.523-0.803,0.855-1.148c0.328-0.344,0.693-0.639,1.102-0.883
c0.406-0.242,0.838-0.432,1.299-0.567c0.465-0.136,0.947-0.204,1.451-0.204c0.57,0,1.111,0.082,1.617,0.248
C72.312,108.136,72.791,108.374,73.238,108.685z"/>
<path fill="#010101" d="M74.336,108.211c0-0.089,0.027-0.165,0.082-0.228c0.057-0.064,0.131-0.098,0.232-0.098h2.104
c0.07,0,0.146,0.03,0.227,0.089c0.076,0.06,0.117,0.139,0.117,0.236v4.024c0.516-0.688,1.025-1.367,1.525-2.037
s1.006-1.35,1.52-2.038c0.051-0.085,0.119-0.151,0.201-0.204c0.082-0.051,0.166-0.078,0.244-0.078h2.711
c0.115,0,0.174,0.038,0.174,0.112c0,0.049-0.027,0.108-0.08,0.177l-3.357,4.586l3.713,5.791c0.055,0.083,0.082,0.148,0.082,0.198
c0,0.074-0.057,0.111-0.16,0.111h-2.693c-0.08,0-0.162-0.024-0.238-0.075c-0.082-0.047-0.145-0.115-0.197-0.198
c-0.252-0.354-0.48-0.694-0.688-1.019c-0.209-0.326-0.41-0.649-0.604-0.973c-0.195-0.32-0.393-0.647-0.592-0.978
c-0.199-0.329-0.418-0.677-0.654-1.042l-0.906,1.079v2.88c0,0.217-0.117,0.325-0.344,0.325h-2.098c-0.213,0-0.32-0.108-0.32-0.325
V108.211z"/>
<path fill="#010101" d="M85.73,115.308c0.082,0.07,0.186,0.162,0.311,0.277c0.127,0.117,0.27,0.23,0.432,0.344
c0.24,0.168,0.484,0.299,0.721,0.392c0.238,0.093,0.486,0.14,0.748,0.14c0.244,0,0.447-0.027,0.609-0.084
c0.166-0.057,0.297-0.132,0.391-0.225c0.094-0.096,0.162-0.202,0.201-0.326c0.039-0.122,0.062-0.252,0.062-0.391
c0-0.152-0.059-0.288-0.166-0.409c-0.115-0.12-0.25-0.228-0.412-0.321s-0.33-0.174-0.508-0.239
c-0.176-0.067-0.328-0.122-0.455-0.165c-0.572-0.208-1.07-0.431-1.498-0.668c-0.428-0.239-0.785-0.506-1.068-0.799
c-0.285-0.293-0.5-0.614-0.645-0.965c-0.143-0.354-0.213-0.744-0.213-1.178c0-0.457,0.09-0.873,0.27-1.247
c0.178-0.374,0.43-0.694,0.764-0.96c0.328-0.265,0.729-0.471,1.193-0.615s0.986-0.219,1.562-0.219
c0.432,0,0.846,0.051,1.242,0.152c0.398,0.101,0.787,0.262,1.172,0.484c0.162,0.098,0.314,0.2,0.461,0.305
c0.146,0.107,0.27,0.209,0.383,0.308c0.109,0.099,0.193,0.192,0.258,0.28c0.066,0.089,0.098,0.166,0.098,0.229
c0,0.064-0.014,0.125-0.045,0.178c-0.031,0.055-0.08,0.115-0.139,0.186l-1.092,1.202c-0.082,0.085-0.162,0.126-0.244,0.126
c-0.066,0-0.127-0.02-0.184-0.059c-0.053-0.039-0.113-0.089-0.18-0.147l-0.066-0.06c-0.092-0.084-0.199-0.17-0.314-0.258
c-0.113-0.089-0.24-0.17-0.371-0.24c-0.137-0.071-0.277-0.131-0.424-0.178s-0.297-0.07-0.451-0.07
c-0.158,0-0.301,0.014-0.443,0.041c-0.133,0.027-0.256,0.07-0.357,0.129c-0.107,0.06-0.191,0.137-0.252,0.232
c-0.062,0.098-0.094,0.213-0.094,0.352s0.033,0.257,0.1,0.357c0.066,0.102,0.166,0.195,0.301,0.281
c0.133,0.086,0.297,0.168,0.492,0.242c0.199,0.078,0.428,0.16,0.691,0.249c0.506,0.173,0.969,0.354,1.395,0.543
c0.424,0.188,0.791,0.413,1.102,0.672c0.307,0.257,0.549,0.567,0.723,0.927s0.26,0.795,0.26,1.307c0,0.541-0.105,1.033-0.32,1.475
c-0.213,0.439-0.506,0.814-0.881,1.125s-0.811,0.551-1.314,0.721c-0.506,0.169-1.045,0.254-1.627,0.254
c-0.547,0-1.084-0.101-1.611-0.304c-0.529-0.202-1.018-0.474-1.477-0.814c-0.189-0.144-0.352-0.284-0.48-0.421
c-0.131-0.139-0.234-0.25-0.311-0.334l-0.021-0.023c-0.006-0.009-0.01-0.016-0.014-0.018s-0.01-0.006-0.016-0.012
c-0.004-0.01-0.01-0.016-0.014-0.018c-0.004-0.003-0.01-0.006-0.016-0.012c-0.109-0.123-0.162-0.223-0.162-0.297
c0-0.083,0.053-0.177,0.162-0.281l1.236-1.219c0.098-0.074,0.18-0.109,0.238-0.109c0.047,0,0.09,0.015,0.139,0.044
S85.666,115.249,85.73,115.308z"/>
</g>
<g>
<path fill="#010101" d="M63.943,66.568h-7.027c-0.32,0.027-0.43,0.142-0.43,0.488v25.245c0,0.455-0.098,0.889-0.287,1.29
c-0.182,0.389-0.432,0.735-0.738,1.026c-0.307,0.287-0.664,0.518-1.066,0.69c-0.979,0.409-2.027,0.317-2.768-0.065
c-0.389-0.201-0.729-0.426-1.014-0.669l-0.717-0.604c-0.166-0.142-0.279-0.232-0.527-0.101c-0.109,0.056-0.209,0.124-0.311,0.216
l-4.141,4.016c-0.084,0.07-0.225,0.181-0.225,0.581c0,0.058,0,0.104,0.002,0.144c0.496,0.758,1.076,1.437,1.727,2.019
c0.658,0.586,1.379,1.087,2.143,1.489c0.762,0.397,1.58,0.703,2.432,0.908c2.275,0.546,4.725,0.356,6.852-0.566
c1.342-0.582,2.535-1.392,3.551-2.406c1.016-1.018,1.836-2.223,2.432-3.581s0.898-2.835,0.898-4.386V67.354
C64.729,66.774,64.523,66.568,63.943,66.568z"/>
<path fill="#010101" d="M91.459,87.919c-0.543-1.129-1.316-2.118-2.295-2.938c-0.994-0.831-2.195-1.563-3.572-2.177
c-1.406-0.626-2.963-1.232-4.623-1.802c-0.883-0.298-1.66-0.576-2.326-0.835c-0.688-0.266-1.277-0.556-1.75-0.862
c-0.498-0.32-0.887-0.686-1.148-1.085c-0.277-0.422-0.416-0.918-0.416-1.474c0-0.557,0.131-1.043,0.389-1.445
c0.252-0.39,0.592-0.706,1.012-0.944c0.393-0.223,0.852-0.387,1.363-0.488c0.984-0.193,2.16-0.229,3.234,0.112
c0.518,0.165,1.021,0.376,1.494,0.629c0.471,0.252,0.914,0.537,1.32,0.847c0.4,0.306,0.766,0.601,1.092,0.89l0.223,0.205
c0.203,0.178,0.389,0.332,0.561,0.455c0.1,0.07,0.201,0.104,0.318,0.104c0.16,0,0.334-0.145,0.453-0.268l3.643-4.018
c0.182-0.204,0.318-0.385,0.404-0.534c0.059-0.102,0.088-0.216,0.088-0.343c0-0.038-0.018-0.182-0.229-0.473
c-0.193-0.267-0.465-0.557-0.803-0.861c-0.352-0.318-0.768-0.653-1.236-0.995c-0.48-0.35-0.986-0.687-1.506-1.003
c-1.23-0.708-2.51-1.236-3.791-1.563c-1.285-0.326-2.646-0.491-4.045-0.491c-1.861,0-3.57,0.238-5.08,0.707
c-1.49,0.464-2.783,1.129-3.838,1.976c-1.039,0.837-1.852,1.86-2.414,3.037c-0.562,1.176-0.846,2.508-0.846,3.961
c0,1.375,0.229,2.639,0.68,3.754c0.449,1.11,1.137,2.145,2.043,3.074c0.916,0.94,2.082,1.809,3.467,2.582
c1.402,0.781,3.064,1.523,4.941,2.202c0.426,0.146,0.939,0.333,1.537,0.558c0.617,0.234,1.211,0.517,1.768,0.84
c0.58,0.334,1.08,0.728,1.488,1.168c0.461,0.493,0.697,1.069,0.697,1.71c0,0.496-0.076,0.987-0.227,1.46
c-0.164,0.494-0.436,0.928-0.811,1.294c-0.367,0.362-0.867,0.655-1.486,0.868c-1.248,0.431-3.262,0.451-4.896-0.192
c-0.822-0.323-1.668-0.782-2.514-1.364c-0.561-0.394-1.064-0.795-1.498-1.193c-0.418-0.383-0.76-0.688-1.025-0.917
c-0.201-0.178-0.369-0.312-0.51-0.397c-0.078-0.049-0.146-0.074-0.191-0.074c-0.006,0-0.15,0.002-0.512,0.271l-4.078,4.035
c-0.375,0.354-0.402,0.539-0.402,0.587c0,0.002,0.004,0.181,0.402,0.635c0.049,0.036,0.09,0.077,0.125,0.124
c0.041,0.036,0.078,0.076,0.109,0.123l0.029,0.029c0.27,0.297,0.613,0.666,1.049,1.125c0.418,0.445,0.939,0.902,1.547,1.358
c1.484,1.108,3.105,2.004,4.822,2.661c3.512,1.348,7.344,1.222,10.5,0.158c1.627-0.549,3.055-1.33,4.248-2.322
c1.189-0.991,2.139-2.205,2.818-3.605c0.68-1.398,1.025-2.985,1.025-4.716C92.281,90.444,92.004,89.046,91.459,87.919z"/>
</g>
</g>
</svg>
<span class="info-copyright">Content licensed under <a href="https://creativecommons.org/" targer="_blank">Creative Commons</a> - Code licensed under <a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a> Static website proudly powered by <a href="https://github.com/JSRocksHQ/harmonic" target="_blank">Harmonic</a></span>
</div>
<aside class="social">
<div class="twitter item-social-footer">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://jsrocks.org/" data-text="Articles, news, tools and tutorials about #ES6" data-via="es6rocks">Tweet</a>
</div>
<div class="facebook item-social-footer">
<div class="fb-like" data-href="http://jsrocks.org/" data-width="auto" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
</div>
<div class="gplus item-social-footer">
<div class="g-plusone" data-size="medium" data-href="http://jsrocks.org/"></div>
</div>
<div class="github item-social-footer">
<iframe src="http://ghbtns.com/github-btn.html?user=JSRocksHQ&repo=jsrockshq.github.io&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
</div>
</aside>
<div class="js-footer">
<a href="#"><img src="/images/icon-logo-js.png" alt="icon JS" title="Javascript"></a>
</div>
</div>
</div>
</div>
</footer>
</div>
<script src="/harmonic.js"></script>
<script src="/js/vendor/jquery.min.js"></script>
<script src="/js/vendor/prism.js"></script>
<script src="/js/vendor/modernizr-2.6.2.min.js"></script>
<script src="/js/vendor/prefixfree.min.js"></script>
<script src="/js/vendor/respond.min.js"></script>
<script src="/js/vendor/scripts-bootstrap.js"></script>
<script src="/js/socialnetwork.js"></script>
<script src="/js/main.js"></script>
<!-- Google Analytics: Altere UA-XXXXX-X pelo ID do seu site. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-51061271-1');ga('send','pageview');
</script>
</body>
</html>
|
hacke2/jsrockshq.github.io
|
index.html
|
HTML
|
mit
| 70,474
|
<?php
session_start();
header('Content-Type: application/json');
require_once('./../../api/utils.php');
if(!$_SESSION['_admin_userid']){
Utils::json(0, '没有获取该数据', 'No permissions');
}
$userid = $_SESSION['_admin_userid'];
//获取页数
$page = $_REQUEST['page'];
if(!$page) $page = 1;
$page = (int)$page;
if($page < 1){
$page = 1;
}
//这里设定每页20条数据
$num = 20;
//查询数据库
$pdo = null;
try{
$pdo = DBHelp::getInstance()->connect();
}catch (PDOException $e){
Utils::json(0, '数据连接异常', 'db link error');
}
//第1步,查询管理员表
$stmt_admin = $pdo->prepare('select email from admin WHERE userid=:userid');
$stmt_admin->bindParam(':userid', $userid);
if(!$stmt_admin->execute()){
Utils::json(0, '你没有登录,不具备管理员权限', 'db admin query error');
}
$stmt_admin = null;
//第2步,查询总条数
$stmt_total = $pdo->prepare('SELECT bookname FROM books;');
$res_total = $stmt_total->execute();
$total = $stmt_total->rowCount();
//第3步计算总页数
$pages = ceil($total / $num);
//第4步,判断传入的页码是否合理
if($page > $pages){
Utils::json(0, '传入的页码有误,该页码大于总页数', 'Can Not Found The page');
}
//第5步,获取该页数据
//计算起始位
$offset = ( $page - 1 ) * $num;
$sql = <<<EOF
SELECT bookid,userid,bookname,time,ispost,repost,linkid,type,isrecommend,is_close
FROM books order by time desc
limit :offset,:num
EOF;
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
$stmt->bindParam(':num', $num, PDO::PARAM_INT);
$is_ok = $stmt->execute();
if(!$is_ok){
$stmt = null;
Utils::json(0, '查询数据库失败', 'db query error');
}
$rows = $stmt->fetchAll(PDO::FETCH_OBJ);
if(!$rows){
$stmt = null;
Utils::json(0, '没有查询到数据', 'db query error');
}
$stmt = null;
//返回结果集
$obj = new stdClass();
$obj->rows = $rows;
$obj->pages = $pages;
$obj->current = $page;
$obj->total = $total;
Utils::json(1, '查询成功', $obj);
?>
|
vczero/aissues
|
base/api/get_books.php
|
PHP
|
mit
| 2,187
|
# Disclosure - A mini maze game.
You have to reach the exit of the maze, but be careful, your flashlight won't last forever...

## Items
You might find some items on your way, they will be stored automagically in your inventory. Here is a list of the available items and their respective use:
### Lights
The more light, the less dark.
* Matchstick
* Lantern
* Flashlight
* Neon
### PassThroughs
The heck? Did you just go through this wall?
Be careful, it might not be _that_ helpful in the dark...
* Axe
* Poleaxe
* Crowbar
## Commands
There is a command bar on top of the map. It can be used to do several stuff, here is a list of what you can do with it (the `>` is optional):
* __use `id`-`level`__ create a random maze of level `level` and with the random seed `id`
* __use `id`__ create a random maze with the seed `id` using your current level
* __reload__ generate a new maze using your current level
* __new__ same as reload
* __black is black__ just try it. you have to finish your level before it takes effect
There is an hidden command too, try with something bright.
## Setup
- `git clone https://github.com/evuez/disclosure`
- `cd disclosure`
- `python main.py`
- `> use 4a6ee54c-7` for instance :)
|
evuez/disclosure
|
README.md
|
Markdown
|
mit
| 1,285
|
#ifndef ILLA_TYPES_H
#define ILLA_TYPES_H
#include "orz/exception.h"
#include <cstdint>
namespace Err {
struct CodecError:public std::runtime_error {
CodecError(const std::string& msg):std::runtime_error("Codec error: " + msg) {}
};
struct InvalidHeader:public CodecError {
InvalidHeader(const std::string& msg):CodecError("InvalidHeader: " + msg) {}
};
}
namespace Img {
enum class Format {
Undefined,
ARGB8888,
XRGB8888,
ARGB1555,
XRGB1555,
RGB565,
Index8,
Num
};
uint8_t EstimatePixelSize(Format sf);
bool HasAlpha(Format sf);
}
std::string ToAString(const Img::Format& imgFormat);
namespace Img
{
std::basic_ostream<char>& operator<<(std::basic_ostream<char>& in, const Img::Format& fmt);
}
#include "color.h"
#include "color_conv.h"
#include "filter_buffer.h"
#include "orz/geom.h"
#include "palette.h"
namespace Filter {
enum class Mode {
Undefined = 255,
DirectCopy = 0,
NearestNeighbor,
Bilinear,
Lanczos3,
Num
};
enum class RotationAngle {
RotateDefault,
FlipX,
FlipY,
Rotate90,
Rotate90FlipY,
Rotate180,
Rotate270,
Rotate270FlipY,
RotateUndefined
};
Geom::SizeInt CalculateUnzoomedSize(Geom::SizeInt defaultDims, Filter::RotationAngle angle);
std::basic_ostream<char>& operator<<(std::basic_ostream<char>& in, const Filter::Mode& m);
}
std::string ToAString(const Filter::RotationAngle& angle);
std::basic_ostream<char>& operator<<(std::basic_ostream<char>& in, const Filter::RotationAngle& c);
namespace Img {
Filter::RotationAngle RotateLeft(Filter::RotationAngle in);
Filter::RotationAngle RotateRight(Filter::RotationAngle in);
struct Properties {
int Brightness;
int Contrast;
int Gamma;
Filter::Mode ResampleFilter;
bool RetainAlpha;
Img::Color BackgroundColor;
float Zoom;
Filter::RotationAngle RequestedAngle;
Filter::RotationAngle MetaAngle;
Filter::RotationAngle FinalAngle() const;
Properties();
};
}
#endif
|
poppeman/Pictus
|
source/deps/illa/types.h
|
C
|
mit
| 1,965
|
require 'minitest_helper'
describe Fog::XenServer::Compute::Models::HostPatchs do
let(:host_patchs_class) { Fog::XenServer::Compute::Models::HostPatchs }
it 'should be a collection of HostPatchs' do
host_patchs_class.model.must_equal(Fog::XenServer::Compute::Models::HostPatch)
end
end
|
fog/fog-xenserver
|
spec/fog/xenserver/compute/models/host_patchs_spec.rb
|
Ruby
|
mit
| 297
|
namespace SimpleJudje.IO
{
using SimpleJudje.Attributes;
using SimpleJudje.Contracts;
using SimpleJudje.Exceptions;
[Alias("cdrel")]
public class ChangeRelativePathCommand : Command, IExecutable
{
[Inject]
private readonly IDirectoryManager inputOutputManager;
public ChangeRelativePathCommand(string input, string[] data) : base(input, data)
{
}
public override void Execute()
{
if (this.Data.Length == 2)
{
string relPath = this.Data[1];
this.inputOutputManager.ChangeCurrentDirectoryRelative(relPath);
}
else
{
throw new InvalidCommandException(this.Input);
}
}
}
}
|
HristoSpasov/C-Sharp-Advanced
|
Bashsoft/SimpleJudje/IO/ChangeRelativePathCommand.cs
|
C#
|
mit
| 786
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- Original URL: http://www.finitegeometry.org/sc/gen/bdes/index.html
Date Downloaded: 1/9/2016 12:17:48 AM !-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--project01-->
<meta name="description" content="Block designs in several senses." />
<meta name="keywords" content="cullinane, block designs, mathematical art, mathematics and art, graphic design" />
<title>Block Designs</title>
</head>
<body leftmargin="100" rightmargin="100">
<!--Navigate-->
<table cellpadding="12" cellspacing="0" width="100%">
<tbody>
<tr bgcolor="#000000">
<td bgcolor="#000000"> <strong><font color="#ffffff"> <small><small>
Finite Geometry Notes</small></small></font><small><small></small></small></strong>
<small><small> <nobr> <font color="#ffffff">|</font> <a href="../../index.html"> <font color="#ffffff"> Home</font></a> <font color="#ffffff">|</font> <a href="../../map.html"> <font color="#ffffff">Site Map</font></a> <font color="#ffffff">|</font> <a href="../../author.html"> <font color="#ffffff"> Author</font></a> <font color="#ffffff">|</font> </nobr></small></small> </td>
</tr>
</tbody>
</table>
<!--EndNavigate-->
<p> <i><font size="3"><b>Design Theory and...</b></font></i> </p>
<p align="center"> <font size="6"><strong>Block Designs</strong></font>
</p>
<p align="center"> <font size="5"><b>in Art and Mathematics</b></font>
</p>
<p align="center"> <strong>by Steven H. Cullinane on February 1, 2004</strong>
</p>
<p> Hartshorne's principle: "Whenever one approaches a subject from two
different directions, there is bound to be an interesting theorem
expressing their relation." - Robin Hartshorne, <a href="http://www.ams.org/notices/200004/fea-hartshorne.pdf">AMS
Notices, April 2000, p. 464</a>. </p>
<hr />
<p> For some aesthetic background, see </p>
<ul>
<li>Brad Appleton's <a href="http://www.cmcrossroads.com/bradapp/docs/patterns-intro.html#QWAN">
Design Patterns</a>, </li>
<li>van Campen's <a href="http://home-1.tiscali.nl/%7Ecretien/pub/gestalt.htm">Gestalt
from Goethe to Gibson</a>, and </li>
<li>Rudolf Arnheim on <a href="http://www.ucpress.edu/books/pages/1495001.html">Visual Thinking</a>.
</li>
</ul>
<hr />
<table align="center" border="0" cellpadding="12" cellspacing="0" width="90%">
<tbody>
<tr>
<td height="21" valign="top">
<p align="center"> <strong>Wechsler Blocks for<br />
<a href="http://alpha.fdu.edu/psychology/as_the_block_turns.htm">
Psychological Testing</a></strong> </p>
<p align="center"> <a href="bdtests.jpg"><img alt="Wechsler Block Design Test" src="WechsWISC.jpg" border="0" height="355" width="190" /></a><small><small><small><small><small><small><small><small><small>
</small></small></small></small></small></small></small><br />
Click on picture for details.</small></small><br />
</p>
</td>
<td height="21" valign="top">
<p align="center"> <strong>Game with<br />
Wechsler Blocks</strong> </p>
<p align="center"> <img src="Trac4.jpg" /> </p>
</td>
</tr>
<tr>
<td height="21" valign="top">
<p align="center"> <strong>Cullinane Blocks<br />
</strong><font size="2">(Click on picture for details.)</font> </p>
<p align="center"> <a href="CullCubes.html"> <img src="DTdiandwh2s.jpg" /> </a> </p>
</td>
<td height="21" valign="top">
<p align="center"> <strong>Cullinane Blocks in Action<br />
</strong><font size="2">(Click on picture for details.)</font> </p>
<p align="center"> <a href="invarofsymm.html"> <img src="DTinvarofsymm2s.jpg" /> </a> </p>
</td>
</tr>
<tr>
<td height="21" valign="top">
<p align="center"> <strong>A Block Design</strong> </p>
<p align="center"> <a href="http://www.york.cuny.edu/%7Emalk/tidbits/blockdesign-tidbit.html">
<font size="2">(in the usual<br />
mathematical sense)</font></a> </p>
<p align="center"> with <a href="http://mathworld.wolfram.com/BlockDesign.html">(<i> v, k,
lambda, r, b</i>)</a> = </p>
<p align="center"> <strong>(7, 3, 1, 3, 7)</strong> </p>
<p align="center"> <font size="2">(Click on picture for details.)</font>
</p>
<p align="center"> <a href="http://www.york.cuny.edu/%7Emalk/tidbits/blockdesign-tidbit.html">
<img src="Fano.gif" /></a> </p>
</td>
<td height="21" valign="top">
<p align="center"> <strong>Cullinane Block Design</strong> </p>
<p align="center"> with <a href="http://mathworld.wolfram.com/BlockDesign.html">(<i> v</i>, <i>k</i>,
<em>lambda</em>, <i>r</i>, <i>b</i>)</a> = </p>
<p align="center"> <strong>(16, 4, 7, 35, 140)</strong> </p>
<p align="center"> <font size="2">(Click on picture for details.)</font>
</p>
<p align="center"> <a href="ortholatin.html"> <img src="DTortholatin2s.jpg" /> </a> </p>
</td>
</tr>
</tbody>
</table>
<p> Note that the 4x4 arrays in the picture at bottom right may serve
as the basis for patterns like those in the picture at top left. The 35
structures in the picture at bottom right may be regarded as
exemplifying the aesthetics of James J. Gibson in his 1978 essay "The
Ecological Approach to the Visual Perception of <nobr>Pictures" --</nobr>
</p>
<p> "What modern painters are trying to do, if they only knew it, is
paint invariants."<br />
<br />
-- James J. Gibson, <i>Leonardo</i>,<br />
Vol. 11, pp. 227-235. Pergamon Press Ltd., 1978 </p>
<p> Gibson is discussing Euclidean 3-space rather than binary 4-space,
but his remarks on invariants are still relevant. </p>
<p align="center"> An example of invariant structure: </p>
<p align="center"> <img src="Invariant.jpg" /> </p>
<p> The three line diagrams above result from the three partitions,
into pairs of 2-element sets, of the 4-element set from which the
entries of the bottom colored figure are drawn. Taken as a set,
these three line diagrams describe the structure of the bottom colored
figure. After coordinatizing the figure in a suitable manner, we
find that this set of three line diagrams is invariant under the group
of 16 binary translations acting on the colored figure. </p>
<p> For another sort of invariance of the colored figure, try applying
a symmetry of the square to each of the set of four diagonally-divided
squares from which the figure's entries are drawn, and observe <a href="../../pg/patt.html">the induced effect on the figure itself</a>.
</p>
<p> A more remarkable invariance -- that of symmetry <nobr>itself --</nobr>
is observed if we arbitrarily and repeatedly permute rows and/or
columns and/or 2x2 quadrants of the colored figure above. <a href="../../16/puzzle/index.html">Each resulting figure has some
ordinary or color-interchange symmetry</a>. The cause of this
symmetry-invariance in the colored patterns is the symmetry-invariance
of the line diagrams under a group of 322,560 binary affine
transformations. </p>
<p> Related material on two meanings of "design theory": </p>
<blockquote>
<p> In the mathematical sense:<br />
<a href="http://www.amazon.com/exec/obidos/tg/detail/-/0521444322/"> <i>Design
Theory</i></a>, by Beth, Jungnickel, and Lenz </p>
<p> In the artistic sense:<br />
<a href="http://www.amazon.com/exec/obidos/ASIN/3775790594/"><i>Visual
Language</i></a>, by Karl Gerstner </p>
</blockquote>
<p> For more details on the above block designs, see </p>
<p align="center"> <a href="../../4/dd/index.html">Theme and Variations</a>,
</p>
<p align="center"> <a href="../../16/geometry.html">Geometry of the
4x4 Square</a>, </p>
<p align="center"> <a href="../GalG.html">Galois Geometry,</a> </p>
<p align="center"> <a href="../ortho.html">Latin-Square Geometry,</a> </p>
<p align="center"> <a href="../walsh.html">Walsh Functions</a> </p>
<p align="center"> <a href="../../16/puzzle/index.html">The Diamond 16
Puzzle</a>, and </p>
<p align="center"> <a href="../dth/DiamondTheory.html">Diamond Theory</a>.
</p>
<hr />
<p align="center"> <img src="stoicheia.gif" /> </p>
<p align="center"> Finally, some examples of the above quarter-diamond<br />
figures applied to the design of quilt blocks: </p>
<table border="0" cellpadding="12" cellspacing="0" width="100%">
<tbody>
<tr>
<td height="21" valign="top">
<p align="center"> <strong>Quilt Block Designs<br />
</strong><strong>by</strong> <a href="http://www.plover.com/%7Emjd/misc/quilt/quilt/"><strong> Mark
Jason Dominus</strong></a> </p>
<p align="center"> <img src="blocks8x9rs.jpg" /> </p>
</td>
<td height="21" valign="top">
<p align="center"> </p>
<p align="center"> <strong>The Dominus Designs<br />
<a href="http://www.plover.com/%7Emjd/misc/quilt/quilt/">in Action</a></strong>
</p>
<p align="center"> <img src="quiltpic.jpg" /> </p>
</td>
</tr>
</tbody>
</table>
<p align="center"> "The very man despising honest quilts<br />
Lies quilted to his poll in his despite."<br />
-- Wallace Stevens, "The Comedian as the Letter C" </p>
<br />
<!--footer-->
<hr />
<p> Page created Feb. 1, 2004 </p>
</body>
</html>
|
m759/m759.github.io
|
gen/bdes/index.html
|
HTML
|
mit
| 9,221
|
# FingerLock
[](https://travis-ci.org/dokun1/FingerLock)
[](https://twitter.com/dokun24)
[](https://github.com/dokun1/FingerLock/blob/master/LICENSE)

## Summary
FingerLock is an **open-source** Swift app that lets you store your passwords and associate usernames, titles, and other notes with them. You can only access your files by TouchID, you can't share them with anyone, and the content saved to disk is scrambled in a unique way for each phone.
I really need to keep up with the times, which means I need to learn Swift. I wanted to make something practical and technically sound, yet decidedly unspectactular.
I'm always open to pull requests on the **develop** branch of this repository, as I am sure I did a lot of things that could be done easier with better knowledge of Swift. This is a learning project more than anything!!!
## Work
You are welcome to play with the code yourself, but you'll notice that the Encryptor class is mysteriously missing ;-) you can email me at **david@okun.io** if you'd like for me to fill in the blank for you!
|
dokun1/FingerLock
|
README.md
|
Markdown
|
mit
| 1,345
|
${io}
<label class="control-label col-xs-12 col-sm-<%- gridLabel%>" for="${<%- main %>[1]}">${<%- main %>[0]}</label>
<% _.each(radios, function(radio, i){ %>
<div class="col-xs-12 col-sm-<%- gridInput%>">
<label class="radio-inline">
<input type="radio" <%if (i < 1) { %> checked="checked" <% } %> ${<%- main %>[2]}><%- radio %>
</label>
</div>
<% }); %>
${oi}
|
pacozaa/uxformbuilder
|
assets/js/templates/snippet/multipleradiosinline.html
|
HTML
|
mit
| 397
|
"""Defines the SMEFT class that provides the main API to smeftrunner."""
from . import rge
from . import io
from . import definitions
from . import beta
from . import smpar
import pylha
from collections import OrderedDict
from math import sqrt
import numpy as np
import ckmutil.phases, ckmutil.diag
class SMEFT(object):
"""Parameter point in the Standard Model Effective Field Theory."""
def __init__(self):
"""Initialize the SMEFT instance."""
self.C_in = None
self.scale_in = None
self.scale_high = None
def set_initial(self, C_in, scale_in, scale_high):
r"""Set the initial values for parameters and Wilson coefficients at
the scale `scale_in`, setting the new physics scale $\Lambda$ to
`scale_high`."""
self.C_in = C_in
self.scale_in = scale_in
self.scale_high = scale_high
def load_initial(self, streams):
"""Load the initial values for parameters and Wilson coefficients from
one or several files.
`streams` should be a tuple of file-like objects strings."""
d = {}
for stream in streams:
s = io.load(stream)
if 'BLOCK' not in s:
raise ValueError("No BLOCK found")
d.update(s['BLOCK'])
d = {'BLOCK': d}
C = io.wc_lha2dict(d)
sm = io.sm_lha2dict(d)
C.update(sm)
C = definitions.symmetrize(C)
self.C_in = C
def set_initial_wcxf(self, wc, scale_high=None, get_smpar=False):
"""Load the initial values for Wilson coefficients from a
wcxf.WC instance.
Parameters:
- `scale_high`: since Wilson coefficients are dimensionless in
smeftrunner but not in WCxf, the high scale in GeV has to be provided.
If this parameter is None (default), either a previously defined
value will be used, or the scale attribute of the WC instance will
be used.
- `get_smpar`: boolean, optional, defaults to True. If True, an attempt
is made to determine the SM parameters from the requirement of
reproducing the correct SM masses and mixings at the electroweak
scale. As approximations are involved, the result might or might not
be reliable, depending on the size of the Wilson coefficients
affecting the SM masses and mixings. If False, Standard Model
parameters have to be provided separately and are assumed to be in
the weak basis used for the Warsaw basis as defined in WCxf,
i.e. in the basis where the down-type and charged lepton mass
matrices are diagonal.
"""
import wcxf
if wc.eft != 'SMEFT':
raise ValueError("Wilson coefficients use wrong EFT.")
if wc.basis != 'Warsaw':
raise ValueError("Wilson coefficients use wrong basis.")
if scale_high is not None:
self.scale_high = scale_high
elif self.scale_high is None:
self.scale_high = wc.scale
C = wcxf.translators.smeft.wcxf2arrays(wc.dict)
keys_dim5 = ['llphiphi']
keys_dim6 = list(set(definitions.WC_keys_0f + definitions.WC_keys_2f + definitions.WC_keys_4f) - set(keys_dim5))
self.scale_in = wc.scale
for k in keys_dim5:
if k in C:
C[k] = C[k]*self.scale_high
for k in keys_dim6:
if k in C:
C[k] = C[k]*self.scale_high**2
C = definitions.symmetrize(C)
# fill in zeros for missing WCs
for k, s in definitions.C_keys_shape.items():
if k not in C and k not in definitions.SM_keys:
if s == 1:
C[k] = 0
else:
C[k] = np.zeros(s)
if self.C_in is None:
self.C_in = C
else:
self.C_in.update(C)
if get_smpar:
self.C_in.update(self._get_sm_scale_in())
def load_wcxf(self, stream, get_smpar=True):
"""Load the initial values for Wilson coefficients from
a file-like object or a string in WCxf format.
Note that Standard Model parameters have to be provided separately
and are assumed to be in the weak basis used for the Warsaw basis as
defined in WCxf, i.e. in the basis where the down-type and charged
lepton mass matrices are diagonal."""
import wcxf
wc = wcxf.WC.load(stream)
self.set_initial_wcxf(wc, get_smpar=get_smpar)
def dump(self, C_out, scale_out=None, stream=None, fmt='lha', skip_redundant=True):
"""Return a string representation of the parameters and Wilson
coefficients `C_out` in DSixTools output format. If `stream` is
specified, export it to a file. `fmt` defaults to `lha` (the SLHA-like
DSixTools format), but can also be `json` or `yaml` (see the
pylha documentation)."""
C = OrderedDict()
if scale_out is not None:
C['SCALES'] = {'values': [[1, self.scale_high], [2, scale_out]]}
else:
C['SCALES'] = {'values': [[1, self.scale_high]]}
sm = io.sm_dict2lha(C_out)['BLOCK']
C.update(sm)
wc = io.wc_dict2lha(C_out, skip_redundant=skip_redundant)['BLOCK']
C.update(wc)
return pylha.dump({'BLOCK': C}, fmt=fmt, stream=stream)
def get_wcxf(self, C_out, scale_out):
"""Return the Wilson coefficients `C_out` as a wcxf.WC instance.
Note that the Wilson coefficients are rotated into the Warsaw basis
as defined in WCxf, i.e. to the basis where the down-type and charged
lepton mass matrices are diagonal."""
import wcxf
C = self.rotate_defaultbasis(C_out)
d = wcxf.translators.smeft.arrays2wcxf(C)
basis = wcxf.Basis['SMEFT', 'Warsaw']
d = {k: v for k, v in d.items() if k in basis.all_wcs and v != 0}
keys_dim5 = ['llphiphi']
keys_dim6 = list(set(definitions.WC_keys_0f + definitions.WC_keys_2f
+ definitions.WC_keys_4f) - set(keys_dim5))
for k in d:
if k.split('_')[0] in keys_dim5:
d[k] = d[k] / self.scale_high
for k in d:
if k.split('_')[0] in keys_dim6:
d[k] = d[k] / self.scale_high**2
d = wcxf.WC.dict2values(d)
wc = wcxf.WC('SMEFT', 'Warsaw', scale_out, d)
return wc
def dump_wcxf(self, C_out, scale_out, fmt='yaml', stream=None, **kwargs):
"""Return a string representation of the Wilson coefficients `C_out`
in WCxf format. If `stream` is specified, export it to a file.
`fmt` defaults to `yaml`, but can also be `json`.
Note that the Wilson coefficients are rotated into the Warsaw basis
as defined in WCxf, i.e. to the basis where the down-type and charged
lepton mass matrices are diagonal."""
wc = self.get_wcxf(C_out, scale_out)
return wc.dump(fmt=fmt, stream=stream, **kwargs)
def rgevolve(self, scale_out, **kwargs):
"""Solve the SMEFT RGEs from the initial scale to `scale_out`.
Returns a dictionary with parameters and Wilson coefficients at
`scale_out`. Additional keyword arguments will be passed to
the ODE solver `scipy.integrate.odeint`."""
self._check_initial()
return rge.smeft_evolve(C_in=self.C_in,
scale_high=self.scale_high,
scale_in=self.scale_in,
scale_out=scale_out,
**kwargs)
def rgevolve_leadinglog(self, scale_out):
"""Compute the leading logarithmix approximation to the solution
of the SMEFT RGEs from the initial scale to `scale_out`.
Returns a dictionary with parameters and Wilson coefficients.
Much faster but less precise that `rgevolve`.
"""
self._check_initial()
return rge.smeft_evolve_leadinglog(C_in=self.C_in,
scale_high=self.scale_high,
scale_in=self.scale_in,
scale_out=scale_out)
def _check_initial(self):
"""Check if initial values and scale as well as the new physics scale
have been set."""
if self.C_in is None:
raise Exception("You have to specify the initial conditions first.")
if self.scale_in is None:
raise Exception("You have to specify the initial scale first.")
if self.scale_high is None:
raise Exception("You have to specify the high scale first.")
def rotate_defaultbasis(self, C):
"""Rotate all parameters to the basis where the running down-type quark
and charged lepton mass matrices are diagonal and where the running
up-type quark mass matrix has the form V.S, with V unitary and S real
diagonal, and where the CKM and PMNS matrices have the standard
phase convention."""
v = sqrt(2*C['m2'].real/C['Lambda'].real)
Mep = v/sqrt(2) * (C['Ge'] - C['ephi'] * v**2/self.scale_high**2/2)
Mup = v/sqrt(2) * (C['Gu'] - C['uphi'] * v**2/self.scale_high**2/2)
Mdp = v/sqrt(2) * (C['Gd'] - C['dphi'] * v**2/self.scale_high**2/2)
Mnup = -v**2 * C['llphiphi']
UeL, Me, UeR = ckmutil.diag.msvd(Mep)
UuL, Mu, UuR = ckmutil.diag.msvd(Mup)
UdL, Md, UdR = ckmutil.diag.msvd(Mdp)
Unu, Mnu = ckmutil.diag.mtakfac(Mnup)
UuL, UdL, UuR, UdR = ckmutil.phases.rephase_standard(UuL, UdL, UuR, UdR)
Unu, UeL, UeR = ckmutil.phases.rephase_pmns_standard(Unu, UeL, UeR)
return definitions.flavor_rotation(C, Uq=UdL, Uu=UuR, Ud=UdR, Ul=UeL, Ue=UeR)
def _run_sm_scale_in(self, C_out, scale_sm=91.1876):
"""Get the SM parameters at the EW scale, using an estimate `C_out`
of the Wilson coefficients at that scale, and run them to the
input scale."""
# initialize an empty SMEFT instance
smeft_sm = SMEFT()
C_in_sm = beta.C_array2dict(np.zeros(9999))
# set the SM parameters to the values obtained from smpar.smeftpar
C_SM = smpar.smeftpar(scale_sm, self.scale_high, C_out, basis='Warsaw')
C_SM = {k: v for k, v in C_SM.items() if k in definitions.SM_keys}
# set the Wilson coefficients at the EW scale to C_out
C_in_sm.update(C_out)
C_in_sm.update(C_SM)
smeft_sm.set_initial(C_in_sm, scale_sm, scale_high=self.scale_high)
# run up (with 1% relative precision, ignore running of Wilson coefficients)
C_SM_high = smeft_sm.rgevolve(self.scale_in, newphys=False, rtol=0.01, atol=1)
return {k: v for k, v in C_SM_high.items() if k in definitions.SM_keys}
def _get_sm_scale_in(self, scale_sm=91.1876):
"""Get an estimate of the SM parameters at the input scale by running
them from the EW scale using constant values for the Wilson coefficients
(corresponding to their leading log approximated values at the EW
scale).
Note that this is not guaranteed to work and will fail if some of the
Wilson coefficients (the ones affecting the extraction of SM parameters)
are large."""
# intialize a copy of ourselves
_smeft = SMEFT()
_smeft.set_initial(self.C_in, self.scale_in, self.scale_high)
# Step 1: run the SM up, using the WCs at scale_input as (constant) estimate
_smeft.C_in.update(self._run_sm_scale_in(self.C_in, scale_sm=scale_sm))
# Step 2: run the WCs down in LL approximation
C_out = _smeft.rgevolve_leadinglog(scale_sm)
# Step 3: run the SM up again, this time using the WCs at scale_sm as (constant) estimate
return self._run_sm_scale_in(C_out, scale_sm=scale_sm)
|
DsixTools/python-smeftrunner
|
smeftrunner/classes.py
|
Python
|
mit
| 11,842
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hammer-tactics: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.4.6~camlp4 / hammer-tactics - 1.2+8.10</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
hammer-tactics
<small>
1.2+8.10
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-11-26 10:22:40 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-11-26 10:22:40 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp4 4.02+7 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
conf-which 1 Virtual package relying on which
coq 8.4.6~camlp4 Formal proof management system.
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0 Build system distributed with the OCaml compiler since OCaml 3.10.0
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/lukaszcz/coqhammer"
dev-repo: "git+https://github.com/lukaszcz/coqhammer.git"
bug-reports: "https://github.com/lukaszcz/coqhammer/issues"
license: "LGPL-2.1-only"
synopsis: "Reconstruction tactics for the hammer for Coq"
description: """
Collection of tactics that are used by the hammer for Coq
to reconstruct proofs found by automated theorem provers. When the hammer
has been successfully applied to a project, only this package needs
to be installed; the hammer plugin is not required.
"""
build: [make "-j%{jobs}%" {ocaml:version >= "4.06"} "tactics"]
install: [
[make "install-tactics"]
[make "test-tactics"] {with-test}
]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
conflicts: [
"coq-hammer" {!= version}
]
tags: [
"keyword:automation"
"keyword:hammer"
"keyword:tactics"
"logpath:Hammer"
"date:2020-04-25"
]
authors: [
"Lukasz Czajka <lukaszcz@mimuw.edu.pl>"
]
url {
src: "https://github.com/lukaszcz/coqhammer/archive/v1.2-coq8.10.tar.gz"
checksum: "sha512=74b1a014f4e1e62148e25d46a4b2c376b927a3481ef52ce853d43f526164bbffd0bf2184653ba13e638d9321635ceec85e7c7b34e08dfa362c5e7a9588dc4b96"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-hammer-tactics.1.2+8.10 coq.8.4.6~camlp4</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.4.6~camlp4).
The following dependencies couldn't be met:
- coq-hammer-tactics -> coq >= 8.10 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-hammer-tactics.1.2+8.10</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
coq-bench/coq-bench.github.io
|
clean/Linux-x86_64-4.02.3-2.0.6/released/8.4.6~camlp4/hammer-tactics/1.2+8.10.html
|
HTML
|
mit
| 7,534
|
---
layout: category-post
title: "Curious Korlia"
excerpt: "aka, the bisonal backdoor"
date: 2014-11-25T18:43:44-05:00
---
### Introduction
Reverse engineers organize discrete of pieces of malware into families. While digging through my malware collection I stumbled across this hash (B8FDFEE08DEEE5CCC1794BAF9ED553CE).
It turns out that this is a sample of the backdoor family known as Korlia. After doing some more digging, it turns out that Korlia doesn't seem to be that well documented or widely known. There is a little bit more written about it here.
Korlia shares a lot of features with common remote access tools. Such as:
* Downloading and executing files
* Listing and controlling processes
* Creating and deleting files
* Creating a remote shell
Given the little amount of public information on Korlia, this made it a good candidate for further research.
There isn't an obvious C2 address called out in strings, although there are some bizarre strings. Depending on luck, those might be actual strings, or code that is being misinterpreted as a string.
<figure>
<img src="/images/korlia_strings.png">
</figure>
Diving in deeper on our first string:
<figure>
<img src="/images/korlia_xref.png">
</figure>
There exists a cross reference to an address. For this case, that is a great sign! This particular piece of data is being referenced somewhere in the code. Let's follow.
In this case we can see that the data is being referenced as global data, and it's mov'd into an EDI. Shortly after, the value 0x1f is loaded into BL. As a general side note, when you see static values being pushed into the lower bytes of a general purpose register this usually means that some loop is going to follow and byte by byte modify a string or array.
<figure>
<img src="/images/korlia_disasm.png">
</figure>
This can be roughly written in Ruby with the following code.
{% highlight ruby %}
{% raw %}
"{ql{ql.1O~ll^l1jl".each_byte {|x| print "#{(x^0x1f).chr}"}
{% endraw %}
{% endhighlight %}
This will return the following information:
~~~
dnsdns1.PassAs.us
~~~
After a little bit of hunting on VirusTotal, I was able to find the following samples. Which also have the following configurations.
MD5|Config Offset|C2|C2|URL
--- | --- | --- | --- | --- | ---
172d68e10715b915ab3268db2174192b|11280|kfsinfo.ByInter.net|61.90.202.197|http://fund.cmc.or.kr/UploadFile/fame/x/mh/o.asp
211c25cdf120f5da8a2258b5d65cc263|14364|0906.toh.info|wew.myMom.info|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
37513c17acfb0b122ffdc3e51501ecc3|11792|since.qpoe.com|69.197.149.98|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
3f7b8f90acc4a01b3377942c409031dc|11808|mycount.MrsLove.com|mycount.MrsLove.com|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
5217a2fc910479d36947d8fe6791d734|12816|mycount.MrsLove.com|mycount.MrsLove.com|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
7807036a74b811c28f1fbb167ef545e3|15900|kazama.myfw.us||http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
7865b3c7e7f40ead123e97aae5dc0a57|17948|shinkhek.myfw.us||http://61.90.202.198/jp/log2.asp
932875565fc6a1356800aa9d3af01670|11792|usababa.myfw.us|indbaba.myfw.us|http://indbabababa.dns94.com/o.asp
b57a30d94872e47186c7ef2e08e6e905|17440|mycount.MrsLove.com|mycount.MrsLove.com|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
b7981c7d028cbfd2f0fe2089de02b391|11792|jennifer998.lookin.at|196.44.49.154|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
b8fdfee08deee5ccc1794baf9ed553ce|11280|dnsdns1.PassAs.us|dnsdns1.PassAs.us|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
c96a92565553c7dc67267c78bc2809bb|14352|since.qpoe.com|applejp.myfw.us|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
cb0e358b534bdce8e2587ef3745b1723|11808|v3net.rr.nu|faceto.UglyAs.com|http://fund.cmc.or.kr/UploadFile/fame/x/mh/o.asp
e47f4ca37db57a9f22d85e021dc891a6|12816|mycount.MrsLove.com|mycount.MrsLove.com|http://fund.cmc.or.kr/UploadFile/fame/x/o0.asp
efe7598c675c1c71f0ad44cc686de587|17948|61.90.202.198|10.0.0.102|http://61.90.202.198/jp/log.asp
The next step in this process is to write a Yara rule looking for this sort of behavior. Writing Yara rules based on strings alone is often problematic as strings are very easy to change and modify. In this case, since we understand how the decoder works, writing a Yara rule for the loop is probably a better bet. While hunting I did find slight variations of the loop (highlighted in the Yara rule below). Those are accounted for in the final rule.
The following rules will catch several variants of Korlia.
~~~ yara
rule korlia
{
meta:
author = "Nick Hoffman "
company = "CBTS - ACS"
information = "korlia malware found in apt dump"
//case a
//b2 1f mov dl, 0x1f ; mov key (wildcard)
// -----------------
//8A 86 98 40 00 71 mov al, byte ptr url[esi]
//BF 98 40 00 71 mov edi, offset url
//32 C2 xor al, dl
//83 C9 FF or ecx, 0FFFFFFFFh
//88 86 98 40 00 71 mov byte ptr url[esi], al
//33 C0 xor eax, eax
//46 inc esi
//F2 AE repne scasb
//F7 D1 not ecx
//49 dec ecx
//3B F1 cmp esi, ecx
//72 DE jb short loc_71001DE0
//case b (variant of loop a)
//8A 8A 28 50 40 00 mov cl, byte_405028[edx]
//BF 28 50 40 00 mov edi, offset byte_405028
//32 CB xor cl, bl
//33 C0 xor eax, eax
//88 8A 28 50 40 00 mov byte_405028[edx], cl
//83 C9 FF or ecx, 0FFFFFFFFh
//42 inc edx
//F2 AE repne scasb
//F7 D1 not ecx
//49 dec ecx
//3B D1 cmp edx, ecx
//72 DE jb short loc_4047F2
//case c (not a variant of the above loop)
//8A 0C 28 mov cl, [eax+ebp]
//80 F1 28 xor cl, 28h
//88 0C 28 mov [eax+ebp], cl
//8B 4C 24 14 mov ecx, [esp+0D78h+var_D64]
//40 inc eax
//3B C1 cmp eax, ecx
//7C EE jl short loc_404F1C
strings:
$a = {b2 ?? 8A 86 98 40 00 71 BF 98 40 00 71 32 c2 83 C9 FF 88 86 98 40 00 71 33 C0 46 F2 AE F7 D1 49 3B F1}
$b = {B3 ?? ?? ?? 8A 8A 28 50 40 00 BF 28 50 40 00 32 CB 33 C0 88 8A 28 50 40 00 83 C9 FF 42 F2 AE F7 D1 49 3B D1}
$c = {8A 0C 28 80 F1 ?? 88 0C 28 8B 4C 24 14 40 3B C1}
$d = {00 62 69 73 6F 6E 61 6C 00} //config marker "\x00bisonal\x00"
condition:
any of them
}
~~~
|
securitykitten/securitykitten.github.io
|
_posts/2014-11-25-curious-korlia.md
|
Markdown
|
mit
| 6,022
|
| <%= ruleId %> | <%= ruleCount %> | <%= visual %> |
|
sven-piller/eslint-formatter-markdown
|
templates/md-template-stats-row.md
|
Markdown
|
mit
| 53
|
define([
'app-lib/vstack'
], function(vstack) {
/*
afterAll(function(done) {
vstack.dropTables().then(function() {
done();
});
});
*/
describe("test that createTables vstack works when tables exist.", function() {
it("returns successfully", function(done) {
done();
vstack.createTables().then(function() {
expect(true).toBeTruthy();
done();
});
});
});
});
|
VStackPlatform/VStack
|
app/test/lib/vstackSpec.js
|
JavaScript
|
mit
| 500
|
package xyz.thepathfinder.chimneyswap;
import com.google.android.gms.maps.model.LatLng;
import com.google.gson.JsonObject;
import java.io.IOException;
import xyz.thepathfinder.android.Cluster;
import xyz.thepathfinder.android.CommodityStatus;
import xyz.thepathfinder.android.Pathfinder;
public class SwapChimneysRequest {
private Chimney chimney1;
private Chimney chimney2;
private String appId;
private String idToken;
public SwapChimneysRequest(String appId, String idToken, Chimney chimney1, Chimney chimney2) {
this.chimney1 = chimney1;
this.chimney2 = chimney2;
this.appId = appId;
this.idToken = idToken;
}
public void swap() {
Pathfinder pathfinder = new Pathfinder(this.appId, this.idToken);
pathfinder.connect();
Cluster defaultCluster = pathfinder.getCluster(SelectionActivity.cluster);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("chimney", 1);
Chimney chimney1 = SwapChimneysRequest.this.chimney1;
LatLng c1Position = chimney1.getPosition();
Chimney chimney2 = SwapChimneysRequest.this.chimney2;
LatLng c2Position = chimney2.getPosition();
defaultCluster.createCommodity(
c1Position.latitude,
c1Position.longitude,
c2Position.latitude,
c2Position.longitude,
CommodityStatus.WAITING,
jsonObject).create();
defaultCluster.createCommodity(
c2Position.latitude,
c2Position.longitude,
c1Position.latitude,
c1Position.longitude,
CommodityStatus.WAITING,
jsonObject).create();
}
}
|
CSSE497/pathfinder-android
|
examples/ChimneySwap/app/src/main/java/xyz/thepathfinder/chimneyswap/SwapChimneysRequest.java
|
Java
|
mit
| 1,764
|
---
layout: page
title: Deleon 45th Anniversary
date: 2016-05-24
author: George Cooper
tags: weekly links, java
status: published
summary: Pellentesque placerat leo non venenatis lacinia. Duis mi justo.
banner: images/banner/leisure-04.jpg
booking:
startDate: 08/14/2016
endDate: 08/17/2016
ctyhocn: ORFGLHX
groupCode: D4A
published: true
---
Cras placerat arcu libero, eget venenatis sapien aliquet et. Proin imperdiet risus at volutpat cursus. Duis non nunc odio. Nunc rhoncus commodo pretium. Aliquam tristique, tortor ut efficitur varius, mi nibh dictum ex, in mattis quam sapien sed erat. Etiam ultricies interdum sem. Praesent at hendrerit libero. Aliquam vel purus eu dui eleifend semper. Duis erat ipsum, porta varius auctor condimentum, pellentesque eu magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Pellentesque metus nunc, pulvinar mattis purus vitae, suscipit rhoncus eros. Morbi semper ornare ligula sit amet volutpat.
1 Nunc et nulla pharetra, varius odio non, imperdiet ipsum
1 Morbi et massa eget lorem iaculis consectetur id in diam
1 Ut faucibus est a mauris semper, eu sagittis diam congue
1 Vestibulum a velit et neque dapibus fringilla nec nec nunc
1 Vivamus maximus erat condimentum, suscipit eros et, laoreet magna
1 Fusce consectetur mi a ligula dapibus mollis.
Donec vulputate ligula vitae diam ullamcorper mollis. Nullam porttitor accumsan pulvinar. Nullam eleifend commodo imperdiet. Suspendisse id velit id metus gravida rutrum eu quis est. Maecenas ut dolor vitae mi malesuada blandit non sit amet massa. Vivamus egestas dolor in pulvinar rutrum. Nam nulla leo, sagittis vel arcu id, convallis mattis nulla. Duis ligula quam, laoreet non maximus at, accumsan tempor dolor. In sagittis augue vitae nulla pharetra dapibus. Mauris tristique in est ut vestibulum. Duis purus nisl, efficitur et vehicula sed, posuere vitae dui. Phasellus semper augue vestibulum, rutrum nunc ac, eleifend augue. Quisque quis justo et erat feugiat finibus. Maecenas at dignissim dolor.
Vestibulum bibendum, purus quis tristique euismod, ante elit fermentum felis, eget scelerisque arcu odio vel velit. Nullam eu dapibus orci. Aliquam vestibulum est orci, sit amet congue ante ullamcorper id. Donec varius vehicula vulputate. Cras sed gravida quam, vulputate pharetra lectus. Donec interdum eu ex vel congue. Praesent malesuada turpis felis, nec feugiat sapien vestibulum eget. Pellentesque non purus sit amet tellus interdum blandit eget quis mauris. Sed sed tincidunt turpis. Curabitur pretium urna et lectus imperdiet molestie. Ut sagittis leo a vestibulum pretium. Nulla facilisi. Sed molestie non tortor vitae pharetra.
|
KlishGroup/prose-pogs
|
pogs/O/ORFGLHX/D4A/index.md
|
Markdown
|
mit
| 2,692
|
# Kraken PHP Framework ~ Release the Kraken!
[](https://travis-ci.org/kraken-php/framework)
[](https://packagist.org/packages/kraken-php/framework)
[](https://packagist.org/packages/kraken-php/framework)
[](https://packagist.org/packages/kraken-php/framework)
[](https://gitter.im/kraken-php/framework?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[](https://twitter.com/kraken_php)
> **Note:** This repository contains the core of the Kraken Framework. If you want to start developing new application with Kraken, check out [Kraken Application Skeleton](https://github.com/kraken-php/kraken). If you want to learn more visit [official website](http://kraken-php.com).
<br>
<p align="center">
<img src="https://avatars2.githubusercontent.com/u/15938282?v=3&s=150" />
</p>
## Description
Kraken is the first and only multi-processed, multi-threaded, fault-tolerant framework for PHP. It has been written to provide easy and reliable API for creating distributed applications using PHP. Kraken aims to solve typical problems of writing such applications and to provide developers with powerful yet elegant tools for dealing with them.
The main focus of Kraken Framework is put on:
* __Concurrency__ : create systems that are asynchronous and concurrent by design,
* __Distribution__ : divide your application into several containers and run them on multiple threads, processors or hosts,
* __Fault tolerance__ : write systems that self-heal using remote and local supervision hierarchies,
* __Elasticity__ : modify existing architecture in realtime without need to change in code,
* __High performance__ : handle up to thousands of connections per second on each container,
* __Extensibility__ : use available options to easily extend and adapt framework features for your needs.
Start writing applications that were previously marked as impossible or hard to implement in PHP right know. Servers, service-oriented architecture, agent-based models, games, complex daemons, socket programs, schedulers and much, much more - nothing is impossible with Kraken!
## Feature Highlights
Kraken features:
* Support for asynchronous programming using fully-featured event Loop with multiple backgrounds.
* Support for event-driven architecture.
* Easy to understand and work with Promise-based API.
* Consistent multi-processing and multi-threading.
* Process and Thread abstraction as isolated message-driven containers.
* Built-in message routing system and IPC abstraction.
* Configurable local and remote supervision hierarchies.
* Centralized deployment and management.
* Extensible Console and Server interface.
* Asynchronous TCP and UDP sockets.
* Asynchronous Stream wrappers.
* Standalone HTTP and WebSocket server.
* Variety of IPC models.
* ReactPHP-compatibility adapters.
* ...and more.
Full list of features can be found on [official website][1].
## Performance
Kraken is able to emit millions of events and thousands of messages and connections per second using single container. It is scalable for multiple processes and threads, faster than traditional PHP approach and able to handle similar amount of connections as Node.js.
<p align="center">
<img src="https://docs.google.com/uc?export=download&id=0B_FVuB10kPjVT21lY3JzVTRwT3c" width="882" height="334" />
</p>
> **Note:** Keep in mind that Kraken project does not solely focus around HTTP performance. It provides a set of distinct asynchronous libraries to use in PHP. The attached graph's main intention is to show that PHP is fast enough to compete with the leading technologies available on the market. The HTTP component has been chosen as it is the only one that can be easily compared between asynchronous and synchronous MVC frameworks. Do not treat it as an actual benchmark.
## Powered By
Kraken Framework is built on top of asynchronous library named [Dazzle Project](https://github.com/dazzle-php/dazzle). If you are looking for a solution simpler than framework, you might consider using it instead.
<br>
<p align="center">
<img src="https://github.com/dazzle-php/dazzle/blob/master/media/dazzle-x125.png" />
</p>
## Requirements
* PHP-5.6 or PHP-7.0+,
* UNIX or Windows OS,
* Additional constraints based on which components you do plan to use.
## Installation and Official Documentation
Documentation for the framework can be found in the [official documentation][2] page. To see installation instructions,
please check out [application skeleton](https://github.com/kraken-php/kraken) or go to [installation guide][3].
## Examples
There are few examples you can try, before deciding to use Kraken:
- [Chat Application](https://github.com/kraken-php/demo-chat).
- [Symfony Integration & Websockets Bundle](https://github.com/kraken-collective/ws-symfony).
- [Symfony Integration & Websockets Bundle Example](https://github.com/kraken-collective/ws-symfony-example).
If you have written your own demo application for Kraken, and want to list it here, contact us!
## Frequently Asked Questions
#### How does the Kraken differ from other PHP async libraries?
> In comparison to already existing PHP async libraries, Kraken gives the developer not only the async tools, but also do the most of the dirty work of creating distributed applications. It gives you consistent interface for working with processes and threads, implements fault-tolerance mechanisms, allows usage of remote and local supervision hierarchies, gives IPC abstractions and implements most important messaging patterns such as routing, heartbeating and much, much more. Instead of thinking how to use async libraries in the new project and how to design the project with them, developer can simply start Kraken instance and focus on its business logic!
#### Is PHP GC able to handle daemonized, long-running application?
> In most cases yes, but developers still have to keep an eye on application memory usage. PHP 5.5+, which is required for
> using framework, is able to successfully deal with proper memory handling and garbage collecting. It proves to be true
> regarding Kraken modules as in development cycle special attention was paid to ensure they do not leak memory. This,
> however, cannot be guaranteed with usage of third party vendors as some (ex. ORMs) are known to be prone to this problem.
> The easiest way to avoid it is to simply use destructors, unset functions and create memory allocation and deallocation
> tests. If despite that you still stumble across this problem, the best way to deal with it is to isolate leaking piece
> of code in separated container and restart it cyclically when it reaches its memory limits.
<br>
If there are any additional questions that you have about framework, please check whether the answers for them have been
already posted in [issues][4] or ask on our [gitter room][8].
## Contributing
Thank you for considering contributing to Kraken Framework! The contribution guide can be found in the [contribution tips][5].
## License
Kraken Framework is open-sourced software licensed under the [MIT license][6]. The documentation is provided under [FDL-1.3 license][7].
[1]: http://kraken-php.com
[2]: http://kraken-php.com/docs
[3]: http://kraken-php.com/docs/installation
[4]: https://github.com/kraken-php/framework/issues
[5]: https://github.com/kraken-php/framework/blob/master/CONTRIBUTING.md
[6]: http://opensource.org/licenses/MIT
[7]: https://www.gnu.org/licenses/fdl-1.3.en.html
[8]: https://gitter.im/kraken-php/framework
|
kraken-php/framework
|
README.md
|
Markdown
|
mit
| 7,925
|
var gulp = require('gulp');
var zip = require('gulp-zip');
var del = require('del');
var install = require('gulp-install');
var runSequence = require('run-sequence');
var awsLambda = require("node-aws-lambda");
gulp.task('clean', function() {
return del(['./dist', './dist.zip']);
});
gulp.task('js', function() {
return gulp.src('index.js')
.pipe(gulp.dest('dist/'));
});
gulp.task('node-mods', function() {
return gulp.src('./package.json')
.pipe(gulp.dest('dist/'))
.pipe(install({production: true}));
});
gulp.task('zip', function() {
return gulp.src(['dist/**/*', '!dist/package.json'])
.pipe(zip('dist.zip'))
.pipe(gulp.dest('./'));
});
gulp.task('upload', function(callback) {
awsLambda.deploy('./dist.zip', require("./lambda-config.js"), callback);
});
gulp.task('deploy', function(callback) {
return runSequence(
['clean'],
['js', 'node-mods'],
['zip'],
['upload'],
callback
);
});
|
davidtron/aws-lambda-pipeline
|
gulpfile.js
|
JavaScript
|
mit
| 1,004
|
# Guía de uso
Para empezar a usar el script, crea un marcador en tu navegador y como URL, copia y pega el contenido del [bookmarklet](https://raw.githubusercontent.com/xusoo/netflix-coming-soon-script/master/dist/bookmarklet.js).

Una vez *instalado*, ve a uno de los siguientes buscadores de Netflix soportados:
- [UnoGS](http://www.unogs.com)
- [FlickSurfer](http://www.flicksurfer.com/)
- [FlixList](http://www.flixlist.com.au/)
- [Moreflicks](http://www.moreflicks.com)
Realiza una búsqueda (películas que hayan ganado un oscar, series de comedia con más de 3 estrellas, thrillers ordenados por nota o directamente el título que te interese):

Ejecuta el script pulsando sobre el marcador y debería salirte una ventana como la siguiente.

Copiamos el código que nos ha generado y nos vamos **Netflix**
Una vez allí y **habiendo accedido con nuestro usuario**, volvemos a pulsar el marcador del script:

Hacemos lo que nos pide, pegamos el código que acabamos de copiar antes y le damos a **Empezar**. El script comenzará a mostrarnos el progreso y cada uno de los títulos que vaya comprobando:

Una vez termine, nos devolverá el resultado de títulos que vayan a estrenarse pronto en la plataforma:

Los de arriba, son títulos que estarán disponibles pero realmente no se sabe cuando, pueden pasar meses. Los de abajo, su llegada está más cerca, puede que sea una semana o un mes, pero pronto.
Y listo. Lo único que nos queda es, si queremos compartir el resultado, pulsar el botón de ***Copiar BBCode***.
|
xusoo/netflix-coming-soon-script
|
HOWTO.md
|
Markdown
|
mit
| 1,760
|
/*
* Usage:
*
* <div class="wppl-cube-grid">
* <div class="wppl-cube wppl-cube1"></div>
* <div class="wppl-cube wppl-cube2"></div>
* <div class="wppl-cube wppl-cube3"></div>
* <div class="wppl-cube wppl-cube4"></div>
* <div class="wppl-cube wppl-cube5"></div>
* <div class="wppl-cube wppl-cube6"></div>
* <div class="wppl-cube wppl-cube7"></div>
* <div class="wppl-cube wppl-cube8"></div>
* <div class="wppl-cube wppl-cube9"></div>
* </div>
*
*/
.wppl-cube-grid {
width: 40px;
height: 40px;
margin: 40px auto;
/*
* Spinner positions
* 1 2 3
* 4 5 6
* 7 8 9
*/ }
.wppl-cube-grid .wppl-cube {
width: 33%;
height: 33%;
float: left;
-webkit-animation: wppl-cubeGridScaleDelay 1.3s infinite ease-in-out;
animation: wppl-cubeGridScaleDelay 1.3s infinite ease-in-out; }
.wppl-cube-grid .wppl-cube1 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s; }
.wppl-cube-grid .wppl-cube2 {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s; }
.wppl-cube-grid .wppl-cube3 {
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s; }
.wppl-cube-grid .wppl-cube4 {
-webkit-animation-delay: 0.1s;
animation-delay: 0.1s; }
.wppl-cube-grid .wppl-cube5 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s; }
.wppl-cube-grid .wppl-cube6 {
-webkit-animation-delay: 0.3s;
animation-delay: 0.3s; }
.wppl-cube-grid .wppl-cube7 {
-webkit-animation-delay: 0.0s;
animation-delay: 0.0s; }
.wppl-cube-grid .wppl-cube8 {
-webkit-animation-delay: 0.1s;
animation-delay: 0.1s; }
.wppl-cube-grid .wppl-cube9 {
-webkit-animation-delay: 0.2s;
animation-delay: 0.2s; }
@-webkit-keyframes wppl-cubeGridScaleDelay {
0%, 70%, 100% {
-webkit-transform: scale3D(1, 1, 1);
transform: scale3D(1, 1, 1); }
35% {
-webkit-transform: scale3D(0, 0, 1);
transform: scale3D(0, 0, 1); } }
@keyframes wppl-cubeGridScaleDelay {
0%, 70%, 100% {
-webkit-transform: scale3D(1, 1, 1);
transform: scale3D(1, 1, 1); }
35% {
-webkit-transform: scale3D(0, 0, 1);
transform: scale3D(0, 0, 1); } }
|
shatmanov/wp-preloader
|
css/cube-grid.css
|
CSS
|
mit
| 2,370
|
import java.util.concurrent.ConcurrentHashMap;
public class ConcurrentHashMapDemo {
public static void main(String[] args) {
// Remember hashes are key-value pairs
// e.g. animal id number to noise it makes
// 1 -> "meow"
// 17 -> "moo"
// 4 -> "cluck"
// Can be in any order, can be gaps
ConcurrentHashMap h = new ConcurrentHashMap();
final int NUM_TIMES = 9999999;
for (int j = 0; j < NUM_TIMES; j++) {
h.put(j, "chirp");
}
for (int j = 0; j < NUM_TIMES; j++) {
h.remove(j);
}
System.out.println("Final size of hash is " + h.size());
}
}
|
laboon/CS1530_Summer2017
|
sample_code/concurrency/ConcurrentHashMapDemo.java
|
Java
|
mit
| 583
|
import {Component} from '@angular/core'
import {JoDirectService, JoDirectResponse, JoDirectCode} from '../../services/jodirect.service'
@Component({
selector: `jodirect-send-page`,
template: `
<div id="parent">
<span [style.display]="itemDisplay">You can only send one message to a token, so make sure you don't make a mistake.</span><br>
<md-input-container [style.display]="itemDisplay">
<input mdInput placeholder="Token" [(ngModel)]="token">
</md-input-container>
<md-input-container [style.display]="itemDisplay">
<textarea mdInput cols="55" rows="15" placeholder="Message" [(ngModel)]="message"></textarea>
</md-input-container>
<span [style.display]="errorDisplay" style="color:red;font-style: italic;font-size: 14px">{{error}}</span>
<br>
<button md-raised-button color="accent" class="button" (click)="onSend()" [style.display]="itemDisplay">
Send
</button>
<span [style.display]="successDisplay">Successfully sent message!</span>
</div>
`,
styles: [`
#parent {
position: absolute;
transform: translateX(-50%) translateY(-50%);
left: 50%;
top: 50%;
text-align: center;
}
.button {
margin-top: 10px;
margin-bottom: 10px;
}
`]
})
export class JoDirectSendComponent {
token = ''
message = ''
error = ''
errorDisplay = 'none'
itemDisplay = 'block'
successDisplay = 'none'
constructor(private joDirectService: JoDirectService) {
}
onSend() {
this.error = ''
this.errorDisplay = 'none'
if (this.token === '') {
this.error = 'Token is empty!'
} else if (this.message === '') {
this.error = 'Message is empty!'
}
if (this.error !== '') {
this.errorDisplay = 'block'
} else {
this.joDirectService.send(this.token, this.message).forEach((response: JoDirectResponse) => {
if (response.status() === JoDirectCode.NO_ERROR) {
this.itemDisplay = 'none'
this.errorDisplay = 'none'
this.successDisplay = 'block'
} else if (response.status() === JoDirectCode.INVALID_TOKEN) {
this.error = this.token + ' does not exists!'
} else if (response.status() === JoDirectCode.MESSAGE_ALREADY_SENT) {
this.error = 'You already sent a message to this token!'
}
if (this.error !== '') {
this.errorDisplay = 'block'
}
})
}
}
}
|
Grarak/grarak.com
|
src/app/pages/jodirect/jodirectsend.component.ts
|
TypeScript
|
mit
| 2,816
|
/**
* Copyright 2008 The University of North Carolina at Chapel Hill
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Eric Meyer's Reset Reloaded
Accessed 3/1/10
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
body {
line-height: 1;
color: black;
background: white;
}
ol, ul {
list-style: none;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: separate;
border-spacing: 0;
}
caption, th, td {
text-align: left;
font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}
|
dee-bee/decisionz
|
decisionz/lib/jquery.xmleditor-master/demo/stylesheets/reset.css
|
CSS
|
mit
| 1,748
|
<?php
if (!count($_POST)) { include DIR."/php/view/admin/landcover.php"; die(); }
use Trust\JSONResponse;
use SSBIN\Landcover;
use Trust\Forms;
use Trust\Pager;
$services = ['saveNew','saveOld','delete','get'];
if (in_array($_POST['a'], $services)) $_POST['a'](); else JSONResponse::Error("Service unavailable");
function get() {
$p = Pager::GetQueryAttributes();
$p->strOrder = ($p->strOrder != "") ? $p->strOrder : " ORDER BY landcover ASC";
$p->landcover = Landcover::allWhere("$p->strWhere $p->strOrder $p->strLimit", []);
$p->totalItems = Landcover::countWhere($p->strWhere, []);
JSONResponse::Success((array)$p);
}
function saveNew() {
$o = Forms::getPostObject('o');
if (trim($o->landcover) == '') JSONResponse::Error("Landcover cannot be empty");
$old = Landcover::find($o->landcover);
if ($old != null) JSONResponse::Error("The landcover $o->landcover already exists");
$o = new Landcover($o);
$o->insert();
JSONResponse::Success(['message'=>"Data successfully added", "new"=>$o]);
}
function saveOld() {
$o = Forms::getPostObject('o');
$target = Forms::getPostObject('target');
if ($o->landcover == $target->landcover) JSONResponse::Error("Landcover unchanged");
if (trim($o->landcover) == '') JSONResponse::Error("Landcover cannot be empty");
$check = Landcover::find($o->landcover);
if ($check != null) JSONResponse::Error("The landcover $o->landcover already exists");
$update = Landcover::find($target->landcover);
$update->landcover = $o->landcover;
$update->setTimestamps();
//Note: Belum bisa $update->save() karena mau update PK juga.
\Trust\DB::exec('UPDATE landcovers SET landcover=:landcover, data_info=:info WHERE landcover=:target',
[
'landcover'=>$o->landcover,
'target'=>$target->landcover,
'info'=>json_encode($update->data_info)
]);
//TODO: Update data findings
JSONResponse::Success(['message'=>"Data successfully updated",'o'=>$update]);
}
function delete() {
$o = Forms::getPostObject('o');
Landcover::delete($o->landcover);
//TODO: setnull data findings
JSONResponse::Success(["message"=>'Data deleted successfully']);
}
|
fandisus/SSBIN
|
php/controller/admin/landcover.php
|
PHP
|
mit
| 2,155
|
// Use this mixin at HTML/BODY level to enable pjax behavior
// Your fluxexapp should provide routeToURL() for this mixin
// See routeToURL.js for more info
//
// To support IE8,
// You will need to npm install html5-history-api,
// then add require('fluxex/extra/history'); in your fluxexapp.js
module.exports = {
componentDidMount: function () {
/*global window,document*/
var blockDoublePop = (document.readyState !== 'complete'),
initState = JSON.stringify(this._getContext()._context),
location = window.history.location || window.location,
initUrl = location.href;
window.addEventListener('load', function() {
setTimeout(function () {
blockDoublePop = false;
}, 1);
});
window.addEventListener('popstate', function (E) {
var state = E.state || ((location.href === initUrl) ? initState : undefined);
if (blockDoublePop && (document.readyState === 'complete')) {
return;
}
try {
state = JSON.parse(state);
} catch (E) {
state = 0;
}
if (!state) {
// NO STATE DATA....can not re-render, so reload.
location.reload();
return;
}
// Ya, trigger page restore by an anonymous action
this.executeAction(function () {
this._restore(state);
this.dispatch('**UPDATEALL**');
return Promise.resolve(true);
}.bind(this._getContext()));
}.bind(this));
},
handleClickLink: function (E) {
var A = E.target.closest('a[href]') || E.target;
var HREF = A.href;
if (!HREF || HREF.match(/#/) || (A.target === '_blank')) {
return;
}
if ((A.target === '_top') && (window.top !== window)) {
return;
}
if ((A.target === '_parent') && (window.parent !== window)) {
return;
}
E.preventDefault();
E.stopPropagation();
return this._getContext().routeToURL(HREF);
}
};
|
zordius/fluxex
|
extra/pjax.js
|
JavaScript
|
mit
| 2,195
|
from collections import namedtuple
import sublime
from sublime_plugin import WindowCommand
from ..git_command import GitCommand
MenuOption = namedtuple("MenuOption", ["requires_action", "menu_text", "filename", "is_untracked"])
CLEAN_WORKING_DIR = "Nothing to commit, working directory clean."
ADD_ALL_UNSTAGED_FILES = " ? All unstaged files"
ADD_ALL_FILES = " + All files"
class GsQuickStageCommand(WindowCommand, GitCommand):
"""
Display a quick panel of unstaged files in the current git repository,
allowing the user to select one or more files for staging.
Display filenames with one of the following indicators:
* [M] modified
* [A] added
* [D] deleted
* [R] renamed/moved
* [C] copied
* [U] updated but unmerged
* [?] untracked
"""
def run(self):
sublime.set_timeout_async(self.run_async)
def run_async(self):
menu_options = self.get_menu_options()
menu_entries = [f.menu_text for f in menu_options]
def on_selection(id):
if id == -1:
return
selection = menu_options[id]
if not selection.requires_action:
return
elif selection.menu_text == ADD_ALL_UNSTAGED_FILES:
self.git("add", "--update", ".")
scope_of_action = "all unstaged files"
elif selection.menu_text == ADD_ALL_FILES:
self.git("add", "--all")
scope_of_action = "all files"
elif selection.is_untracked:
self.git("add", "--", selection.filename)
scope_of_action = "`{}`".format(selection.filename)
else:
self.git("add", "--update", "--", selection.filename)
scope_of_action = "`{}`".format(selection.filename)
sublime.status_message("Successfully added `{}`.".format(
scope_of_action))
sublime.set_timeout_async(self.run_async, 0)
self.window.show_quick_panel(
menu_entries,
on_selection,
flags=sublime.MONOSPACE_FONT
)
def get_menu_options(self):
"""
Determine the git status of the current working directory, and return
a list of menu options for each file that is shown.
"""
status_entries = self.get_status()
menu_options = []
for entry in status_entries:
if entry.working_status in ("M", "D", "?"):
filename = (entry.path if not entry.index_status == "R"
else entry.path + " <- " + entry.path_alt)
menu_text = "[{0}] {1}".format(entry.working_status, filename)
menu_options.append(MenuOption(True, menu_text, filename, entry.index_status == "?"))
if not menu_options:
return [MenuOption(False, CLEAN_WORKING_DIR, None, None)]
menu_options.append(MenuOption(True, ADD_ALL_UNSTAGED_FILES, None, None))
menu_options.append(MenuOption(True, ADD_ALL_FILES, None, None))
return menu_options
|
ypersyntelykos/GitSavvy
|
core/commands/quick_stage.py
|
Python
|
mit
| 3,133
|
## Top Ranked Startups in Gibraltar
1. [easy.office](http://www.startupranking.com/easy-office)
2. [epic-brands](http://www.startupranking.com/epic-brands)
3. [fair-game-studio](http://www.startupranking.com/fair-game-studio)
|
softvar/awesome-startups
|
countries/gibraltar.md
|
Markdown
|
mit
| 228
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef SYSCOIN_UTIL_TIME_H
#define SYSCOIN_UTIL_TIME_H
#include <stdint.h>
#include <string>
#include <chrono>
void UninterruptibleSleep(const std::chrono::microseconds& n);
/**
* Helper to count the seconds of a duration.
*
* All durations should be using std::chrono and calling this should generally be avoided in code. Though, it is still
* preferred to an inline t.count() to protect against a reliance on the exact type of t.
*/
inline int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
/**
* DEPRECATED
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
*/
int64_t GetTime();
/** Returns the system time (not mockable) */
int64_t GetTimeMillis();
/** Returns the system time (not mockable) */
int64_t GetTimeMicros();
/** Returns the system time (not mockable) */
int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable
/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
void SetMockTime(int64_t nMockTimeIn);
/** For testing */
int64_t GetMockTime();
/** Return system time (or mocked time, if set) */
template <typename T>
T GetTime();
/**
* ISO 8601 formatting is preferred. Use the FormatISO8601{DateTime,Date}
* helper functions if possible.
*/
std::string FormatISO8601DateTime(int64_t nTime);
std::string FormatISO8601Date(int64_t nTime);
// SYSCOIN
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
std::string DurationToDHMS(int64_t nDurationTime);
int64_t ParseISO8601DateTime(const std::string& str);
#endif // SYSCOIN_UTIL_TIME_H
|
syscoin/syscoin2
|
src/util/time.h
|
C
|
mit
| 1,810
|
<HTML><HEAD>
<TITLE>Review for Best Man, The (1999/I)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0168501">Best Man, The (1999/I)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Jonathan+F+Richards">Jonathan F Richards</A></H3><HR WIDTH="40%" SIZE="4">
<PRE>WRITER'S BLACK</PRE>
<PRE>THE BEST MAN
Written and Directed by
With Taye Diggs, Nia Long
UA North R 118 min</PRE>
<P> "The Best Man" is a potboiler told with inoffensive slickness and
dependable moral values, and peopled with an attractive ensemble cast. Its
paperback plot involves Harper (Taye Diggs), whose first novel is about to
be published as he heads for New York to be best man at his best friend's
wedding. Advance copies are already circulating among the old college pals
who are the core of the wedding party. Skeletons come tumbling out of
closets as his friends recognize themselves and the things they did in
college thinly disguised in Harper's autobiographical fiction. Since one
of the things he did was sleep with the bride (Monica Calhoun), and since
the groom (Morris Chestnut) is Lance, a monster running back for the New
York Giants, this ill-timed early sampling of his roman-a-clef is
particularly awkward for Harper, although the alert viewer will be
wondering what the hell he thought the effect of his revelations would be
on his pals if they'd surfaced after the wedding.</P>
<P>First time writer/director Malcolm D. Lee has a terrible weakness for
exposition in the early scenes (which is where exposition traditionally
rears its ugly head.) "Oprah wants my new unpublished novel *Unfinished
Business*" Harper sings out to his girlfriend Robin (Sanaa Lathan) as he
comes in the door. When Lance is introduced, Lee gives us a long closeup
of the cross hanging around his neck, to establish his credentials as a
Christian running back, which we will find out anyway soon enough.</P>
<P>But once you get by the exposition, the talented and beautiful cast of
young African-American actors takes over and delivers a story of passions
and friendships and self-discovery that, while far from original, still
makes itself agreeable and satisfying. Taye Diggs, the hunk from "How
Stella Got Her Groove Back" whose career is justifiably in meteoric rise,
smiles his jaw-to-jaw perfect smile and takes his shirt off and throws in
some good acting to boot. There's no letdown with the other actors, with
the exception of Melissa DeSousa's gratingly bitchy Shelby, and
particularly good are Harold Perrineau as the sweetly unassertive Murch and
Terrence Howard as the sly, troublemaking Quentin. There are no white
characters, which seems a little contrived in a group so pointedly
mainstream. </P>
<HR><P CLASS=flush><SMALL>The review above was posted to the
<A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR>
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.<BR>
Please direct comments/criticisms of the review to relevant newsgroups.<BR>
Broken URLs inthe reviews are the responsibility of the author.<BR>
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
</SMALL></P>
<P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P>
</P></BODY></HTML>
|
xianjunzhengbackup/code
|
data science/machine_learning_for_the_web/chapter_4/movie/21417.html
|
HTML
|
mit
| 3,674
|
import angular from 'angular';
import { Inject, Bind } from 'angular-es-utils';
import {hasScrolled} from '../../../common/utils/style-helper';
import { isPromiseLike } from 'angular-es-utils/type-auth';
@Inject('$scope', '$element')
export default class DropdownSelectCtrl {
// 选项 item 字段映射
static defaultMapping = {
valueField: 'value',
displayField: 'title',
iconField: 'icon'
};
constructor() {
this.datalist = [];
this._clampedDatalist = [];
this.items = [];
this.mapping = {};
this.title = '';
this.placeholder = '';
this.searchable = false;
this.supportInputValue = false;
this.model = null;
this.focusIndex = 0;
this.isOpen = false;
this.autoClose = true;
this.isActive = false;
this.oldText = '';
this.containerElement = null;
this.onSelectChange = () => {};
this.onDropdownOpen = () => {};
this.onDropdownClose = () => {};
this._openFn = null;
}
$onInit() {
this._prepareOptions();
this._prepareWatches();
}
$postLink() {
this._prepareMouseEvents();
this._prepareKeyboardEvents();
}
_prepareOptions() {
const defaultMapping = DropdownSelectCtrl.defaultMapping;
this.mapping = Object.assign({}, defaultMapping, this.mapping);
this.items = this._getClampedDatalist(this.datalist || []);
if (typeof this.autoClose !== 'undefined' && this.autoClose !== false) {
this.autoClose = true;
}
if (typeof this.disabled === 'undefined') {
this.disabled = false;
}
this.onSelectChange = this.onSelectChange || (() => {});
}
_prepareWatches() {
const scope = this.getScope();
scope.$watch(() => this.datalist, (datalist, oldDatalist) => {
this.model = this.modelCopy ? this.modelCopy : this.model;
this.items = this._clampedDatalist = this._getClampedDatalist(datalist || []);
// TODO: SB requirement
if (this.supportInputValue) {
this._searchText = this.model;
}
// 选中预设值
this.setModelValue(this.model);
// 设置预设值的 focusIndex
this.focusAt(this.getItemIndexByItemValue(this.model, this.items));
});
scope.$watch(() => this.model, (model, oldModel) => {
if (this.model && (!this.items || !this.items.length)) {
this.modelCopy = this.model;
}
if (!angular.equals(model, oldModel)) {
const item = this.getItemByValue(this.model);
const itemIndex = this.getItemIndexByItemValue(this.model, this.items);
if (this.supportInputValue) {
this._searchText = this.model;
}
this.setModelValue(this.model);
this.focusAt(itemIndex);
// 增加回调参数 itemIndex item
this.onSelectChange({ model, oldModel, itemIndex, item });
}
});
scope.$watch(() => this.isOpen, (openState, oldOpenstate) => {
if (this.disabled && openState) {
this.isOpen = false;
}
});
}
_prepareMouseEvents() {
let inputElement = this.getInputElement();
if (!this.searchable) {
inputElement.addEventListener('click', this.toggle);
} else {
this._openFn = this::(event => {
let scope = this.getScope();
this.open();
scope.$root.$$phase || scope.$apply();
inputElement.removeEventListener('click', this._openFn);
});
inputElement.addEventListener('click', this._openFn);
}
}
_prepareKeyboardEvents() {
let keydownFn = event => {
let scope = this.getScope();
let keyCode = event.keyCode;
if (!this.isOpen) {
// 下拉激活且关闭时,按 回车、上、下 键打开下拉
if (keyCode === 13 || keyCode === 38 || keyCode === 40) {
this.open();
}
} else {
switch (keyCode) {
case 13: // enter
this.selectItemAt(this.focusIndex);
break;
case 38: // up
this.focusUp();
event.preventDefault();
break;
case 40: // down
this.focusDown();
event.preventDefault();
break;
default:
}
}
scope.$root.$$phase || scope.$digest();
};
this.getScope().$watch(() => this.isActive, (isActive, oldState) => {
if (isActive !== oldState) {
let inputElement = this.getInputElement();
if (isActive) {
inputElement.addEventListener('keydown', keydownFn);
} else {
inputElement.removeEventListener('keydown', keydownFn);
}
}
});
}
onSearchTextChange(text) {
this._searchText = text;
if (text !== this.oldText) {
this.oldText = text;
text = text.trim();
if (!this.isOpen) {
this.open();
}
if (text.length) {
this._search(text);
} else {
this.setModelValue(null);
this.items = this._clampedDatalist;
}
this.focusAt(0);
}
}
onOpen() {
let scope = this.getScope();
const input = this.getInputElement();
input.focus();
if (this.searchable && this.title && this.title.length) {
this._search(this.title);
this.focusAt(0);
scope.$root.$$phase || scope.$apply();
}
// 如果有下拉选项框有滚动条, 且滚动条没有置顶, 进行置顶
const itemList = this.getItemListElement();
if (hasScrolled(itemList) && itemList.scrollTop !== 0) {
itemList.scrollTop = 0;
}
const containerHeight = this.containerElement ? this.containerElement.getClientRects()[0].bottom : document.documentElement.clientHeight;
// 将菜单滚动到可视区域
if (input.getClientRects()[0].bottom + itemList.getClientRects()[0].height > containerHeight) {
itemList.scrollIntoView({behavior: 'smooth', block: 'end', inline: 'nearest'});
}
this.onDropdownOpen();
}
onClose() {
let scope = this.getScope();
if (this.searchable) {
this.getInputElement().addEventListener('click', this._openFn);
this.setModelValue(this.model);
scope.$root.$$phase || scope.$apply();
}
this.onDropdownClose();
}
getItemByValue(value) {
const valueField = this.mapping.valueField;
return this.items.find(item => angular.equals(item[valueField], value));
}
setModelValue(modelValue) {
const displayField = this.mapping.displayField;
const iconField = this.mapping.iconField;
const newItem = this.getItemByValue(modelValue);
if (newItem) {
this.title = newItem[displayField];
this.model = modelValue;
this.icon = newItem[iconField];
} else {
if (this.supportInputValue) {
this.title = this._searchText;
this.model = this._searchText;
this.icon = false;
this.items = this._clampedDatalist;
} else {
this.title = '';
this.model = null;
this.icon = false;
this.items = this._clampedDatalist;
}
}
}
clear() {
this._searchText = null;
this.modelCopy = null;
this.setModelValue(null);
this.getInputElement().focus();
this.focusAt(0);
}
@Bind
toggle() {
let scope = this.getScope();
if (this.isOpen) {
this.close();
} else {
this.open();
}
scope.$root.$$phase || scope.$apply();
}
open() {
this.isOpen = true;
}
close() {
this.isOpen = false;
}
selectItemAt(index) {
const item = this.items[index];
const scope = this.getScope();
if (!item) {
return;
}
this.onBeforeSelectChange = this.onBeforeSelectChange || (() => Promise.resolve());
let callbackResult = this.onBeforeSelectChange({ item });
if (!isPromiseLike(callbackResult)) {
callbackResult = Promise.resolve(callbackResult);
}
callbackResult
.then(() => {
scope.$evalAsync(() => {
this.title = item[this.mapping.displayField];
this.model = item[this.mapping.valueField];
this.icon = item[this.mapping.iconField];
this.focusAt(index);
this.close();
});
})
.catch(() => {
scope.$evalAsync(() => this.close());
});
// todo Promise.prototype.finally travis-ci 暂时不支持等支持后修改
}
focusAt(index) {
this.focusIndex = index;
}
focusUp() {
let index = this.focusIndex - 1;
if (index < 0) {
index = 0;
}
this.focusAt(index);
let itemElement = this.getItemElementAt(index);
if (itemElement) {
itemElement.scrollIntoView(true);
}
}
focusDown() {
let listCount = this.items.length;
let index = this.focusIndex + 1;
if (index > listCount - 1) {
index = listCount - 1;
}
this.focusAt(index);
let itemElement = this.getItemElementAt(index);
if (itemElement) {
itemElement.scrollIntoView(false);
}
}
getElement() {
return this._$element[0];
}
getInputElement() {
return this.getElement().querySelector('.dropdown-select-input');
}
getItemListElement() {
return this.getElement()
.querySelector('.dropdown-list');
}
getItemElementAt(index) {
return this.getItemListElement()
.querySelectorAll('li:not(.empty-list-item)')[index];
}
getScope() {
return this._$scope;
}
highlight(content, hiText) {
if (!this.searchable || !hiText) {
return content;
}
return content.replace(new RegExp(hiText, 'gi'), '<span class="highlight">$&</span>');
}
getItemIndexByItemValue(ItemValue, items) {
return items.findIndex(item => {
return item[this.mapping.valueField] === ItemValue;
});
}
_getClampedDatalist(datalist) {
// 将每个 item 构造为对象
// e.g. 将 ['北京', '上海'] 构造为
// [{title: '北京', value: '北京'}, {title: '上海', value: '上海'}]
return datalist.map(item => {
if (typeof item !== 'object') {
return {
[this.mapping.displayField]: item,
[this.mapping.valueField]: item
};
} else {
return item;
}
});
}
_search(text) {
let datalist = this._clampedDatalist;
let mapping = this.mapping;
let searchFields = [mapping.valueField, mapping.displayField];
let filteredItems = [];
searchFields.forEach(field => {
datalist.forEach(item => {
const fieldValue = item[field];
if (fieldValue.toString().toLocaleUpperCase().indexOf(text && text.toLocaleUpperCase()) !== -1 &&
filteredItems.indexOf(item) === -1) {
filteredItems.push(item);
}
});
});
this.items = filteredItems;
}
};
|
ShuyunFF2E/ccms-components
|
src/components/dropdown/dropdown-select/DropdownSelectCtrl.js
|
JavaScript
|
mit
| 9,781
|
# standard imports
import os
import logging
import traceback
# Qt imports
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QPlainTextEdit
# toolbox imports
from dltb.util.debug import edit
# GUI imports
from ..utils import protect
# logging
LOG = logging.getLogger(__name__)
class QLogHandler(QPlainTextEdit, logging.Handler):
"""A log handler that displays log messages in a QWidget.
A :py:class:`QLogHandler` can be used
"""
_message_signal = pyqtSignal(str)
def __init__(self, parent=None):
# FIXME[question]: can we use real python multiple inheritance here?
# (that is just super().__init__(*args, **kwargs))
QPlainTextEdit.__init__(self, parent)
logging.Handler.__init__(self)
self.setReadOnly(True)
self._records = []
self._counter = 1
self._message_signal.connect(self.appendMessage)
self._message_signal.emit("Log view initialized")
def __len__(self):
"""The number of lines in this QLogHandler.
"""
return self._counter
def clear(self):
"""Clear this :py:class:QLogHandler.
"""
super().clear()
self._records.clear()
self._counter = 1
self._message_signal.emit("Log view cleared")
@pyqtSlot(str)
def appendMessage(self, message: str):
message = message.replace(os.linesep, '\\n')
self.appendPlainText(message)
self.verticalScrollBar().setValue(self.verticalScrollBar().maximum())
def emit(self, record: logging.LogRecord) -> None:
"""Handle a :py:class:logging.logRecord.
"""
# Here we have to be careful: adding the text directly to the
# widget from another thread causes problems: The program
# crashes with the following message:
# QObject::connect: Cannot queue arguments of type 'QTextBlock'
# (Make sure 'QTextBlock' is registered using qRegisterMetaType().)
# Hence we are doing this via a signal now.
self._counter += 1
self.setToolTip(f"List of log records ({self._counter} entries)")
try:
self._records.append(record)
self._message_signal.emit(self.format(record))
except AttributeError as error:
# FIXME[bug/problem]
# When quitting the program while running some background
# thread (e.g. camera loop), we get the following exception:
# AttributeError: 'QLogHandler' does not have a signal with
# the signature _message_signal(QString)
#print(error)
#print(f" type of record: {type(record)}")
#print(f" record: {record}")
#print(f" signal: {self._message_signal}")
pass
@protect
def mouseReleaseEvent(self, event):
cursor = self.cursorForPosition(event.pos())
block = cursor.blockNumber()
print(block, len(self._records))
if block < len(self._records):
print(self._records[block])
record = self._records[block]
LOG.info(f"Trying to open file {record.pathname}, "
f"line {record.lineno}, in an external editor.")
try:
retcode = edit(record.pathname, record.lineno)
if retcode < 0:
LOG.error("Edit command was terminated by signal "
f"{-retcode}")
else:
LOG.info(f"Edit command returned: {retcode}")
except OSError as error:
LOG.error(f"Edit command failed: {error}")
class QExceptionView(QPlainTextEdit):
"""A view for Python exceptions. This is basically a text field in
which a :py:class:`BaseException` can be displayed, including its
stack trace.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.setReadOnly(True)
self._exception = None
self._traceback = None
def setException(self, exception: BaseException) -> None:
"""Set the :py:class:`BaseException` to be displayed in this
:py:class:`QExceptionView`
"""
self._exception = exception
self._traceback = traceback.extract_tb(exception.__traceback__)
# _traceback is basicall a list of traceback.FrameSummary,
# each providing the following attributes:
# - filename
# - line
# - lineno
# - locals
# - name
self.clear()
for m in traceback.format_list(self._traceback):
self.appendPlainText(m)
self.verticalScrollBar().setValue(self.verticalScrollBar().maximum())
@protect
def mouseReleaseEvent(self, event) -> None:
"""Handle a mouse release event. When pressed on a frame in the stack
trace, open the correspoding code line in an external editor.
"""
cursor = self.cursorForPosition(event.pos())
frame_number = cursor.blockNumber() // 2
if self._traceback is not None and frame_number < len(self._traceback):
self.editFrame(self._traceback[frame_number])
def editFrame(self, frame: traceback.FrameSummary):
"""Edit the the code file described by the given stack frame in an
external editor.
"""
LOG.info(f"Trying to open file {frame.filename}, "
f"line {frame.lineno}, in an external editor.")
try:
retcode = edit(frame.filename, frame.lineno)
if retcode < 0:
LOG.error("Edit command was terminated by signal "
f"{-retcode}")
else:
LOG.info(f"Edit command returned: {retcode}"
f"({'error' if retcode else 'success'})")
except OSError as error:
LOG.error(f"Edit command failed: {error}")
|
Petr-By/qtpyvis
|
qtgui/widgets/logging.py
|
Python
|
mit
| 5,929
|
正则表达式
去掉html中的tags:
示例:
demo.html
<b>This</b> is what <span style="text-decoration: underline;">I</span> meant. Understand?
替换命令:
# 如果你这样搞的话,就会有问题
$ sed 's/<.*>//g' demo.html
meant. Understand?
# 要解决上面的那个问题,就得像下面这样。
# 其中的'[^>]' 指定了除了>的字符重复0次或多次。
$ sed 's/<[^>]*>//g' demo.html
This is what I meant. Understand?
Ref: http://coolshell.cn/articles/9104.html
http://coolshell.cn/articles/5426.html
http://coolshell.cn/articles/11564.html
http://coolshell.cn/articles/9070.html
http://coolshell.cn/articles/8883.html
http://coolshell.cn/articles/8619.html
输出你最常用的十条命令
history|awk ‘{print $2}’|awk ‘BEGIN {FS=”|”} {print $1}’|sort|uniq -c|sort -rn|head -10)
Linux命令行与Shell脚本编程大全(第2版)
|
sunyoboy/java-tutorial
|
book/Sed.md
|
Markdown
|
mit
| 955
|
import dispatcher from "../stores/dispatcher";
export function createPosts(post) {
dispatcher.dispatch({
type: "CREATE_POST",
post
});
}
export function deletePost(id) {
dispatcher.dispatch({
type: "DELETE_POST",
id
})
}
|
melvinodsa/my-react-experiments
|
2-personal-website/js/components/actions/postActions.js
|
JavaScript
|
mit
| 234
|
#include "editaddressdialog.h"
#include "ui_editaddressdialog.h"
#include "addresstablemodel.h"
#include "guiutil.h"
#include <QDataWidgetMapper>
#include <QMessageBox>
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) :
QDialog(parent),
ui(new Ui::EditAddressDialog), mapper(0), mode(mode), model(0)
{
ui->setupUi(this);
GUIUtil::setupAddressWidget(ui->addressEdit, this);
switch(mode)
{
case NewReceivingAddress:
setWindowTitle(tr("New receiving address"));
ui->addressEdit->setEnabled(false);
break;
case NewSendingAddress:
setWindowTitle(tr("New sending address"));
break;
case EditReceivingAddress:
setWindowTitle(tr("Edit receiving address"));
ui->addressEdit->setEnabled(false);
break;
case EditSendingAddress:
setWindowTitle(tr("Edit sending address"));
break;
}
mapper = new QDataWidgetMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
}
EditAddressDialog::~EditAddressDialog()
{
delete ui;
}
void EditAddressDialog::setModel(AddressTableModel *model)
{
this->model = model;
if(!model)
return;
mapper->setModel(model);
mapper->addMapping(ui->labelEdit, AddressTableModel::Label);
mapper->addMapping(ui->addressEdit, AddressTableModel::Address);
}
void EditAddressDialog::loadRow(int row)
{
mapper->setCurrentIndex(row);
}
bool EditAddressDialog::saveCurrentRow()
{
if(!model)
return false;
switch(mode)
{
case NewReceivingAddress:
case NewSendingAddress:
address = model->addRow(
mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive,
ui->labelEdit->text(),
ui->addressEdit->text());
break;
case EditReceivingAddress:
case EditSendingAddress:
if(mapper->submit())
{
address = ui->addressEdit->text();
}
break;
}
return !address.isEmpty();
}
void EditAddressDialog::accept()
{
if(!model)
return;
if(!saveCurrentRow())
{
switch(model->getEditStatus())
{
case AddressTableModel::OK:
// Failed with unknown reason. Just reject.
break;
case AddressTableModel::NO_CHANGES:
// No changes were made during edit operation. Just reject.
break;
case AddressTableModel::INVALID_ADDRESS:
QMessageBox::warning(this, windowTitle(),
tr("The entered address \"%1\" is not a valid Pixicoin address.").arg(ui->addressEdit->text()),
QMessageBox::Ok, QMessageBox::Ok);
break;
case AddressTableModel::DUPLICATE_ADDRESS:
QMessageBox::warning(this, windowTitle(),
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()),
QMessageBox::Ok, QMessageBox::Ok);
break;
case AddressTableModel::WALLET_UNLOCK_FAILURE:
QMessageBox::critical(this, windowTitle(),
tr("Could not unlock wallet."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case AddressTableModel::KEY_GENERATION_FAILURE:
QMessageBox::critical(this, windowTitle(),
tr("New key generation failed."),
QMessageBox::Ok, QMessageBox::Ok);
break;
}
return;
}
QDialog::accept();
}
QString EditAddressDialog::getAddress() const
{
return address;
}
void EditAddressDialog::setAddress(const QString &address)
{
this->address = address;
ui->addressEdit->setText(address);
}
|
pixicoin/pixicoin
|
src/qt/editaddressdialog.cpp
|
C++
|
mit
| 3,732
|
package metrics_test
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/gkarlik/quark-go"
"github.com/gkarlik/quark-go/metrics/prometheus"
"github.com/gkarlik/quark-go/middleware/metrics"
tr "github.com/gkarlik/quark-go/service/trace/noop"
"github.com/stretchr/testify/assert"
)
type TestService struct {
*quark.ServiceBase
}
type TestHttpHandler struct{}
func (h *TestHttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
}
func TestMetricsMiddleware(t *testing.T) {
a, _ := quark.GetHostAddress(1234)
ts := &TestService{
ServiceBase: quark.NewService(
quark.Name("TestService"),
quark.Version("1.0"),
quark.Address(a),
quark.Metrics(prometheus.NewMetricsExposer()),
quark.Tracer(tr.NewTracer())),
}
defer ts.Dispose()
mm := metrics.NewRequestMetricsMiddleware(ts)
r, _ := http.NewRequest(http.MethodGet, "/test", nil)
w := httptest.NewRecorder()
h := mm.Handle(&TestHttpHandler{})
h.ServeHTTP(w, r)
assert.Equal(t, http.StatusOK, w.Code)
}
func TestMetricsMiddlewareWithNext(t *testing.T) {
a, _ := quark.GetHostAddress(1234)
ts := &TestService{
ServiceBase: quark.NewService(
quark.Name("TestService"),
quark.Version("1.0"),
quark.Address(a),
quark.Metrics(prometheus.NewMetricsExposer()),
quark.Tracer(tr.NewTracer())),
}
defer ts.Dispose()
mm := metrics.NewRequestMetricsMiddleware(ts)
r, _ := http.NewRequest(http.MethodGet, "/test", nil)
w := httptest.NewRecorder()
th := &TestHttpHandler{}
mm.HandleWithNext(w, r, th.ServeHTTP)
assert.Equal(t, http.StatusOK, w.Code)
}
|
gkarlik/quark-go
|
middleware/metrics/middleware_test.go
|
GO
|
mit
| 1,598
|
//
// eBayAPIHandler.h
// QRPrice
//
// Created by Alec Kretch on 2/12/16.
// Copyright © 2016 Alec Kretch. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Constants.h"
@class EBayAPIHandler;
@protocol EBayAPIHandlerDelegate <NSObject>
- (void)getEbayCategoryId:(NSString *)categoryId;
- (void)getEbayProductImageURL:(NSString *)url;
- (void)getEbayProductPrice:(float)price;
- (void)getEbayProductTitle:(NSString *)title;
- (void)getEbayTotalEntries:(int)entries;
@end
@interface EBayAPIHandler : NSObject <NSURLConnectionDelegate, NSXMLParserDelegate>
{
NSURLConnection *currentConnectionGeneric;
NSURLConnection *currentConnectionPricing;
NSXMLParser *xmlParserGeneric;
NSXMLParser *xmlParserPricing;
}
@property (retain, nonatomic) NSMutableData *apiReturnXMLData;
@property (copy, nonatomic) NSString *currentElement;
@property (nonatomic, weak) id<EBayAPIHandlerDelegate> delegate;
- (void)getGenericInformationForISBN:(NSString *)iSBN;
- (void)getPricingInformationForISBN:(NSString *)iSBN;
@end
|
aleckretch/QRPrice
|
Source/QRPrice/QRPrice/EBayAPIHandler.h
|
C
|
mit
| 1,052
|
---
author: admin
comments: true
date: 2006-10-11 06:03:00
layout: post
slug: i-want-prison-break
title: I Want Prison Break
wordpress_id: 127
categories:
- 蛋疼的事
---
每个人都活在一座监狱里
TOBECONTINUE……
|
besteric/besteric.github.io
|
_posts/2006-10-11-i-want-prison-break.markdown
|
Markdown
|
mit
| 233
|
#!/bin/bash
## Parse command line arguments
## !! --> Also, will mkdir the install location if it does not exist!
for i in "$@"; do case $i in
-p=*|--prefix=*) PREFIX="${i#*=}"; shift;;
-b=*|--build=*) BUILDTYPE="${i#*=}"; shift;;
-s=*|--searchpath=*) SEARCHPATH="${i#*=}"; shift;;
-t|--test) TEST="YES"; shift;;
*) MASS+="${i#*=} "; shift;;
esac; done
absolute() { echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"; }
if [ ! -z "$PREFIX" ]; then
mkdir -p $PREFIX || ( echo Permission to mkdir $PREFIX denied && exit 1 );
PREFIX=$(absolute $PREFIX);
elif [ -w /usr/local ]; then
PREFIX=/usr/local;
elif [ -d ~/.local ]; then
PREFIX=$(absolute ~/.local );
else
echo Run with admin privileges or choose a non-system install path with --prefix && exit 1;
fi;
if [ ! -w $PREFIX ]; then echo Permission to write to $PREFIX denied && exit 1; fi
if [ -z "$BUILDTYPE" ]; then BUILDTYPE=Release; fi
if [ -z "$SEARCHPATH" ]; then SEARCHPATH=$PREFIX; fi
if [ -d "$SEARCHPATH" ]; then SEARCHPATH=$(absolute $SEARCHPATH); else exit 1; fi
|
shaunharker/CHomP
|
.install/parse.sh
|
Shell
|
mit
| 1,124
|
/*
* This is a part of the BugTrap package.
* Copyright (c) 2005-2009 IntelleSoft.
* All rights reserved.
*
* Description: Preview dialog.
* Author: Maksim Pyatkovskiy.
*
* This source code is only intended as a supplement to the
* BugTrap package reference and related electronic documentation
* provided with the product. See these sources for detailed
* information regarding the BugTrap package.
*/
#include "StdAfx.h"
#include "resource.h"
#include "PreviewDlg.h"
#include "BugTrapUtils.h"
#include "ResManager.h"
#include "LayoutManager.h"
#include "Splitter.h"
#include "TextFormat.h"
#include "TextView.h"
#include "HexView.h"
#include "ImageView.h"
#include "Globals.h"
#include "WaitCursor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define IDC_ZOOMIN 101
#define IDC_ZOOMOUT 102
#define IDC_RESETSIZE 103
#define IDC_FITIMAGE 104
/**
* @addtogroup BugTrapUI BugTrap Graphical User Interface
* @{
*/
/// Control layouts for Preview dialog.
static LAYOUT_INFO g_arrPreviewLayout[] =
{
LAYOUT_INFO(IDC_SPLITTER, ALIGN_LEFT, ALIGN_TOP, ALIGN_RIGHT, ALIGN_BOTTOM),
LAYOUT_INFO(IDC_FILEFORMAT_FRAME, ALIGN_LEFT, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_BOTTOM),
LAYOUT_INFO(IDC_TEXTVIEW, ALIGN_LEFT, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_BOTTOM),
LAYOUT_INFO(IDC_HEXVIEW, ALIGN_LEFT, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_BOTTOM),
LAYOUT_INFO(IDCANCEL, ALIGN_RIGHT, ALIGN_BOTTOM, ALIGN_RIGHT, ALIGN_BOTTOM),
LAYOUT_INFO(IDC_IMAGE_COMMANDS, ALIGN_LEFT, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_BOTTOM)
};
/// File list column identifiers.
enum FILE_LIST_COLUMN_ID
{
/// File name.
CID_FILE_NAME,
/// File type.
CID_FILE_TYPE,
/// File size.
CID_FILE_SIZE
};
/// File information.
struct FILE_ITEM_INFO
{
/// File size.
DWORD dwFileSize;
#pragma warning(push)
#pragma warning(disable : 4200) // nonstandard extension used : zero-sized array in struct/union
/// File name.
TCHAR szFileName[0];
#pragma warning(pop)
};
/// File view type.
enum FILE_VIEW_TYPE
{
/// No file view.
FVT_NONE,
/// Text view.
FVT_TEXTVIEW,
/// Hexadecimal view.
FVT_HEXVIEW,
/// Image view.
FVT_IMAGEVIEW
};
/// Dialog layout manager.
static CLayoutManager g_LayoutMgr;
/// Splitter window.
static CSplitter g_Splitter(CSplitter::SD_VERTICAL, true);
/// File list sort order.
static CListViewOrder g_FilesListOrder;
/// Text view.
static CTextView g_TextView;
/// Hex view.
static CHexView g_HexView;
/// Image view.
static CImageView g_ImageView;
/// Current file view type.
static FILE_VIEW_TYPE g_eFileViewType = FVT_NONE;
/// Current file handle.
static HANDLE g_hFile = INVALID_HANDLE_VALUE;
/// Image handle.
static HBITMAP g_hBitmap = NULL;
/// True if file contains text.
static BOOL g_bTextFile = FALSE;
/// Text encoding.
static TEXT_ENCODING g_eEncoding = TXTENC_ANSI;
/// Size of encoding signature.
static DWORD g_dwSignatureSize = 0;
/// Tool-bar image-list.
static HIMAGELIST g_hImageList = NULL;
/// List of tool-bar buttons.
static const TBBUTTON g_arrButtons[] =
{
{ 0, IDC_ZOOMIN, TBSTATE_ENABLED, BTNS_BUTTON },
{ 1, IDC_ZOOMOUT, TBSTATE_ENABLED, BTNS_BUTTON },
{ 2, IDC_RESETSIZE, TBSTATE_ENABLED, BTNS_BUTTON },
{ 3, IDC_FITIMAGE, TBSTATE_ENABLED, BTNS_BUTTON }
};
/**
* @brief Show or hide file format options.
* @param hwnd - parent window handle.
* @param bShow - pass true to show file format options and false otherwise.
*/
static void ShowFileFormatOptions(HWND hwnd, BOOL bShow)
{
int nCmdShow = bShow ? SW_SHOWNA : SW_HIDE;
UINT arrFileFormatItems[] =
{
IDC_TEXTVIEW, IDC_HEXVIEW, IDC_FILEFORMAT_FRAME
};
for (int nFileFormatItem = 0; nFileFormatItem < countof(arrFileFormatItems); ++nFileFormatItem)
{
HWND hwndCtl = GetDlgItem(hwnd, arrFileFormatItems[nFileFormatItem]);
ShowWindow(hwndCtl, nCmdShow);
}
}
/**
* @brief Show or hide image commands.
* @param hwnd - parent window handle.
* @param bShow - pass true to show image commands and false otherwise.
*/
static void ShowImageCommands(HWND hwnd, BOOL bShow)
{
HWND hwndCtl = GetDlgItem(hwnd, IDC_IMAGE_COMMANDS);
int nCmdShow = bShow ? SW_SHOWNA : SW_HIDE;
ShowWindow(hwndCtl, nCmdShow);
}
/**
* @brief Set text view mode.
* @param hwnd - parent window handle.
*/
static void SetTextView(HWND hwnd)
{
_ASSERTE(g_hFile != INVALID_HANDLE_VALUE);
g_eFileViewType = FVT_TEXTVIEW;
HWND hwndFileView = GetDlgItem(hwnd, IDC_FILEVIEW);
g_TextView.Attach(hwndFileView);
g_TextView.SetFile(g_hFile, g_eEncoding, g_dwSignatureSize);
}
/**
* @brief Set hex view mode.
* @param hwnd - parent window handle.
*/
static void SetHexView(HWND hwnd)
{
_ASSERTE(g_hFile != INVALID_HANDLE_VALUE);
g_eFileViewType = FVT_HEXVIEW;
HWND hwndFileView = GetDlgItem(hwnd, IDC_FILEVIEW);
g_HexView.Attach(hwndFileView);
g_HexView.SetFile(g_hFile);
}
/**
* @brief Set image view mode.
* @param hwnd - parent window handle.
*/
static void SetImageView(HWND hwnd)
{
_ASSERTE(g_hBitmap != INVALID_HANDLE_VALUE);
g_eFileViewType = FVT_IMAGEVIEW;
HWND hwndFileView = GetDlgItem(hwnd, IDC_FILEVIEW);
g_ImageView.Attach(hwndFileView);
g_ImageView.SetImage(g_hBitmap);
}
/**
* @brief Close previous file view.
* @param hwnd - parent window handle.
*/
static void CloseFileView(HWND hwnd)
{
switch (g_eFileViewType)
{
case FVT_TEXTVIEW:
ShowFileFormatOptions(hwnd, FALSE);
g_TextView.Detach();
break;
case FVT_HEXVIEW:
ShowFileFormatOptions(hwnd, FALSE);
g_HexView.Detach();
break;
case FVT_IMAGEVIEW:
ShowImageCommands(hwnd, FALSE);
g_ImageView.Detach();
break;
}
g_eFileViewType = FVT_NONE;
}
/**
* @brief Close file handle.
*/
static void CloseFileHandle(void)
{
if (g_hBitmap != NULL)
{
DeleteBitmap(g_hBitmap);
g_hBitmap = NULL;
}
if (g_hFile != INVALID_HANDLE_VALUE)
{
CloseHandle(g_hFile);
g_hFile = INVALID_HANDLE_VALUE;
}
g_dwSignatureSize = 0;
}
/**
* @brief Close file view pane and close file handle.
* @param hwnd - parent window handle.
*/
inline static void CloseViewPane(HWND hwnd)
{
CloseFileView(hwnd);
CloseFileHandle();
}
/**
* @brief WM_COMMAND handler of Preview dialog.
* @param hwnd - window handle.
* @param id - control ID.
* @param hwndCtl - control handle.
* @param codeNotify - notification code.
*/
static void PreviewDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
codeNotify; hwndCtl;
switch (id)
{
case IDC_TEXTVIEW:
if (g_eFileViewType == FVT_HEXVIEW)
{
g_HexView.Detach();
SetTextView(hwnd);
}
break;
case IDC_HEXVIEW:
if (g_eFileViewType == FVT_TEXTVIEW)
{
g_TextView.Detach();
SetHexView(hwnd);
}
break;
case IDC_FITIMAGE:
g_ImageView.FitImage();
break;
case IDC_RESETSIZE:
g_ImageView.ResetSize();
break;
case IDC_ZOOMIN:
g_ImageView.ZoomIn();
break;
case IDC_ZOOMOUT:
g_ImageView.ZoomOut();
break;
case IDOK:
case IDCANCEL:
EndDialog(hwnd, FALSE);
break;
}
}
/**
* @brief WM_SIZE handler of Preview dialog.
* @param hwnd - window handle.
* @param state - window state.
* @param cx - window width.
* @param cy - window height.
*/
static void PreviewDlg_OnSize(HWND hwnd, UINT state, int cx, int cy)
{
hwnd; cx; cy; state;
g_LayoutMgr.ApplyLayout();
}
/**
* @brief WM_GETMINMAXINFO handler of Preview dialog.
* @param hwnd - window handle.
* @param pMinMaxInfo - window min-max info.
*/
static void PreviewDlg_OnGetMinMaxInfo(HWND hwnd, PMINMAXINFO pMinMaxInfo)
{
hwnd;
pMinMaxInfo->ptMinTrackSize = g_LayoutMgr.GetMinTrackSize();
}
/**
* @brief Add file item to the list.
* @param hwndFileList - file list view.
* @param pszFilePath - file path.
*/
static void AddFileItem(HWND hwndFileList, PCTSTR pszFilePath)
{
int nItemPos = ListView_GetItemCount(hwndFileList);
SHFILEINFO sfi;
ZeroMemory(&sfi, sizeof(sfi));
HIMAGELIST hFileImages = (HIMAGELIST)SHGetFileInfo(pszFilePath, 0, &sfi, sizeof(sfi), SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_TYPENAME);
if (nItemPos == 0)
{
_ASSERTE((GetWindowLongPtr(hwndFileList, GWL_STYLE) & LVS_SHAREIMAGELISTS) != 0);
ListView_SetImageList(hwndFileList, hFileImages, LVSIL_SMALL);
}
DWORD dwFileSize;
WIN32_FIND_DATA FindData;
HANDLE hFindFile = FindFirstFile(pszFilePath, &FindData);
TCHAR szFileSize[32];
if (hFindFile != INVALID_HANDLE_VALUE)
{
dwFileSize = FindData.nFileSizeLow;
if (dwFileSize >= 1000000000)
_stprintf_s(szFileSize, countof(szFileSize), _T("%lu.%lu GB"), dwFileSize / 1000000000, (dwFileSize % 1000000000) / 100000000);
else if (dwFileSize >= 1000000)
_stprintf_s(szFileSize, countof(szFileSize), _T("%lu.%lu MB"), dwFileSize / 1000000, (dwFileSize % 1000000) / 100000);
else if (dwFileSize >= 1000)
_stprintf_s(szFileSize, countof(szFileSize), _T("%lu.%lu KB"), dwFileSize / 1000, (dwFileSize % 1000) / 100);
else
_stprintf_s(szFileSize, countof(szFileSize), _T("%lu B"), dwFileSize);
FindClose(hFindFile);
}
else
{
*szFileSize = _T('\0');
dwFileSize = 0;
}
DWORD dwFilePathSize = (DWORD)_tcslen(pszFilePath) + 1;
FILE_ITEM_INFO* pFileItemInfo = (FILE_ITEM_INFO*)new BYTE[sizeof(FILE_ITEM_INFO) + dwFilePathSize * sizeof(TCHAR)];
if (pFileItemInfo != NULL)
{
pFileItemInfo->dwFileSize = dwFileSize;
_tcscpy_s(pFileItemInfo->szFileName, dwFilePathSize, pszFilePath);
}
LVITEM lvi;
ZeroMemory(&lvi, sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
lvi.iItem = nItemPos;
lvi.pszText = PathFindFileName(pszFilePath);
lvi.iImage = sfi.iIcon;
lvi.lParam = (LPARAM)pFileItemInfo;
ListView_InsertItem(hwndFileList, &lvi);
ListView_SetItemText(hwndFileList, nItemPos, CID_FILE_TYPE, sfi.szTypeName);
ListView_SetItemText(hwndFileList, nItemPos, CID_FILE_SIZE, szFileSize);
}
/**
* @brief Compare two list view items.
* @param lParam1 - 1st item index.
* @param lParam2 - 2nd item index.
* @param lParamSort - sort argument.
* @return comparison result.
*/
static int CALLBACK FileSizeCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
LISTVIEW_SORT_PARAMS* pLVSortParams = (LISTVIEW_SORT_PARAMS*)lParamSort;
FILE_ITEM_INFO* pFileItem1Info = (FILE_ITEM_INFO*)lParam1;
FILE_ITEM_INFO* pFileItem2Info = (FILE_ITEM_INFO*)lParam2;
int iResult = Comparator(pFileItem1Info->dwFileSize, pFileItem2Info->dwFileSize);
return (pLVSortParams->bAscending ? iResult : -iResult);
}
/**
* Attempt to open file as image.
* @param hwnd - parent window handle.
* @param pszFileName - source file name.
* @return true if file successfully opened and false otherwise.
*/
static BOOL OpenImageFile(HWND hwnd, PCTSTR pszFileName)
{
_ASSERTE(g_hBitmap == NULL);
static const TCHAR szBmpFileExt[] = _T(".bmp");
size_t nFileNameLength = _tcslen(pszFileName);
const size_t nBmpFileExtLength = countof(szBmpFileExt) - 1;
if (nFileNameLength >= nBmpFileExtLength && _tcsicmp(pszFileName + nFileNameLength - nBmpFileExtLength, szBmpFileExt) == 0 &&
(g_hBitmap = (HBITMAP)LoadImage(NULL, pszFileName, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE)) != NULL)
{
g_eFileViewType = FVT_IMAGEVIEW;
SetImageView(hwnd);
ShowImageCommands(hwnd, TRUE);
return TRUE;
}
return FALSE;
}
/**
* Attempt to open file in text or binary mode.
* @param hwnd - parent window handle.
* @param pszFileName - source file name.
* @return true if file successfully opened and false otherwise.
*/
static BOOL OpenRegularFile(HWND hwnd, PCTSTR pszFileName)
{
_ASSERTE(g_hFile == INVALID_HANDLE_VALUE);
g_hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (g_hFile != INVALID_HANDLE_VALUE)
{
g_dwSignatureSize = DetectFileFormat(pszFileName, g_hFile, g_bTextFile, g_eEncoding);
UINT uCtrlID;
if (g_bTextFile)
{
uCtrlID = IDC_TEXTVIEW;
SetTextView(hwnd);
}
else
{
uCtrlID = IDC_HEXVIEW;
SetHexView(hwnd);
}
CheckRadioButton(hwnd, IDC_TEXTVIEW, IDC_HEXVIEW, uCtrlID);
ShowFileFormatOptions(hwnd, TRUE);
return TRUE;
}
return FALSE;
}
/**
* @brief WM_NOTIFY handler of Preview dialog.
* @param hwnd - window handle.
* @param idCtrl - identifier of the common control sending the message.
* @param pnmh - pointer to an NMHDR structure that contains the notification code and additional information.
*/
static LRESULT PreviewDlg_OnNotify(HWND hwnd, int idCtrl, LPNMHDR pnmh)
{
switch (pnmh->code)
{
case LVN_ITEMCHANGED:
{
if (idCtrl != IDC_FILESLIST)
break;
LPNMLISTVIEW pnmv = (LPNMLISTVIEW)pnmh;
if ((pnmv->uNewState & LVIS_SELECTED) != (pnmv->uOldState & LVIS_SELECTED))
{
if (pnmv->uNewState & LVIS_SELECTED)
{
_ASSERTE(g_hFile == INVALID_HANDLE_VALUE && g_hBitmap == NULL);
HWND hwndFileList = GetDlgItem(hwnd, IDC_FILESLIST);
LVITEM lvi;
ZeroMemory(&lvi, sizeof(lvi));
lvi.mask = LVIF_PARAM;
lvi.iItem = pnmv->iItem;
ListView_GetItem(hwndFileList, &lvi);
FILE_ITEM_INFO* pFileItemInfo = (FILE_ITEM_INFO*)lvi.lParam;
if (pFileItemInfo != NULL)
{
CWaitCursor wait(true);
if (! OpenImageFile(hwnd, pFileItemInfo->szFileName))
OpenRegularFile(hwnd, pFileItemInfo->szFileName);
}
}
else
CloseViewPane(hwnd);
}
}
break;
case LVN_COLUMNCLICK:
{
if (idCtrl != IDC_FILESLIST)
break;
LPNMLISTVIEW pnmv = (LPNMLISTVIEW)pnmh;
HWND hwndFileList = GetDlgItem(hwnd, IDC_FILESLIST);
g_FilesListOrder.ToggleSortParams(hwndFileList, pnmv->iSubItem);
LISTVIEW_SORT_PARAMS lvSortParams;
lvSortParams.hwndList = hwndFileList;
lvSortParams.iColumnNumber = pnmv->iSubItem;
lvSortParams.bAscending = g_FilesListOrder.GetSortOrder();
switch (pnmv->iSubItem)
{
case CID_FILE_NAME:
case CID_FILE_TYPE:
lvSortParams.eCompareType = LISTVIEW_SORT_PARAMS::ICT_STRING;
ListView_SortItemsEx(hwndFileList, &ListViewCompareFunc, (LPARAM)&lvSortParams);
break;
case CID_FILE_SIZE:
lvSortParams.eCompareType = LISTVIEW_SORT_PARAMS::ICT_INTEGER;
ListView_SortItems(hwndFileList, &FileSizeCompareFunc, (LPARAM)&lvSortParams);
break;
}
}
break;
case TTN_GETDISPINFO:
{
LPTOOLTIPTEXT ptt = (LPTOOLTIPTEXT)pnmh;
ptt->hinst = g_hInstance;
ptt->uFlags |= TTF_DI_SETITEM;
switch (ptt->hdr.idFrom)
{
case IDC_ZOOMIN:
ptt->lpszText = MAKEINTRESOURCE(IDS_ZOOMIN);
break;
case IDC_ZOOMOUT:
ptt->lpszText = MAKEINTRESOURCE(IDS_ZOOMOUT);
break;
case IDC_RESETSIZE:
ptt->lpszText = MAKEINTRESOURCE(IDS_RESETSIZE);
break;
case IDC_FITIMAGE:
ptt->lpszText = MAKEINTRESOURCE(IDS_FITIMAGE);
break;
}
}
break;
}
return FALSE;
}
/**
* @brief WM_INITDIALOG handler of Preview dialog.
* @param hwnd - window handle.
* @param hwndFocus - system-defined focus window.
* @param lParam - user-defined parameter.
* @return true to setup focus to system-defined control.
*/
static BOOL PreviewDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
lParam; hwndFocus;
_ASSERTE(g_pResManager != NULL);
if (g_pResManager->m_hBigAppIcon)
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)g_pResManager->m_hBigAppIcon);
if (g_pResManager->m_hSmallAppIcon)
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)g_pResManager->m_hSmallAppIcon);
CenterWindow(hwnd, GetParent(hwnd));
g_hImageList = ImageList_LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_IMAGETOOLBAR), 16, 0, RGB(0xC0, 0xC0, 0xC0));
HWND hwndImgToolbar = GetDlgItem(hwnd, IDC_IMAGE_COMMANDS);
LONG_PTR lStyle = GetWindowLongPtr(hwndImgToolbar, GWL_STYLE);
SetWindowLongPtr(hwndImgToolbar, GWL_STYLE, lStyle | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS);
SendMessage(hwndImgToolbar, TB_SETIMAGELIST, 0, (LPARAM)g_hImageList);
SendMessage(hwndImgToolbar, TB_ADDBUTTONS, countof(g_arrButtons), (LPARAM)g_arrButtons);
HWND hwndFileList = GetDlgItem(hwnd, IDC_FILESLIST);
ListView_SetExtendedListViewStyle(hwndFileList, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);
RECT rcList;
GetClientRect(hwndFileList, &rcList);
rcList.right -= GetSystemMetrics(SM_CXHSCROLL);
TCHAR szColumnTitle[64];
LVCOLUMN lvc;
ZeroMemory(&lvc, sizeof(lvc));
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = szColumnTitle;
lvc.cx = rcList.right / 2;
LoadString(g_hInstance, IDS_COLUMN_FILE, szColumnTitle, countof(szColumnTitle));
ListView_InsertColumn(hwndFileList, CID_FILE_NAME, &lvc);
lvc.cx = rcList.right / 4;
LoadString(g_hInstance, IDS_COLUMN_TYPE, szColumnTitle, countof(szColumnTitle));
ListView_InsertColumn(hwndFileList, CID_FILE_TYPE, &lvc);
lvc.cx = rcList.right / 4;
LoadString(g_hInstance, IDS_COLUMN_SIZE, szColumnTitle, countof(szColumnTitle));
ListView_InsertColumn(hwndFileList, CID_FILE_SIZE, &lvc);
g_hFile = INVALID_HANDLE_VALUE;
g_hBitmap = NULL;
g_eFileViewType = FVT_NONE;
if (g_dwFlags & BTF_DETAILEDMODE)
{
TCHAR szFindFileTemplate[MAX_PATH];
PathCombine(szFindFileTemplate, g_szInternalReportFolder, _T("*"));
WIN32_FIND_DATA FindData;
HANDLE hFindFile = FindFirstFile(szFindFileTemplate, &FindData);
if (hFindFile != INVALID_HANDLE_VALUE)
{
BOOL bMore = TRUE;
while (bMore)
{
if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
TCHAR szFilePath[MAX_PATH];
PathCombine(szFilePath, g_szInternalReportFolder, FindData.cFileName);
AddFileItem(hwndFileList, szFilePath);
}
bMore = FindNextFile(hFindFile, &FindData);
}
FindClose(hFindFile);
}
}
else
AddFileItem(hwndFileList, g_szInternalReportFilePath);
size_t nFileCount = g_arrLogLinks.GetCount();
for (size_t nFilePos = 0; nFilePos < nFileCount; ++nFilePos)
{
CLogLink* pLogLink = g_arrLogLinks[nFilePos];
_ASSERTE(pLogLink != NULL);
PCTSTR pszFilePath = pLogLink->GetLogFileName();
AddFileItem(hwndFileList, pszFilePath);
}
HWND hwndSplitter = GetDlgItem(hwnd, IDC_SPLITTER);
g_Splitter.Attach(hwndSplitter);
RECT rect;
GetClientRect(hwndFileList, &rect);
// Set splitter position according to initial dialog layout.
g_Splitter.SetSplitterPos(rect.bottom);
g_Splitter.SetPanel(0, hwndFileList);
HWND hwndFileView = GetDlgItem(hwnd, IDC_FILEVIEW);
g_Splitter.SetPanel(1, hwndFileView);
g_LayoutMgr.InitLayout(hwnd, g_arrPreviewLayout, countof(g_arrPreviewLayout));
// LVM_SETIMAGELIST resets header control image list
g_FilesListOrder.InitList(hwndFileList);
return TRUE;
}
/**
* @brief WM_DESTROY handler of Preview dialog.
* @param hwnd - window handle.
*/
static void PreviewDlg_OnDestroy(HWND hwnd)
{
ImageList_Destroy(g_hImageList);
g_hImageList = NULL;
HWND hwndFileList = GetDlgItem(hwnd, IDC_FILESLIST);
LVITEM lvi;
ZeroMemory(&lvi, sizeof(lvi));
lvi.mask = LVIF_PARAM;
int nNumItems = ListView_GetItemCount(hwndFileList);
for (int nItemNum = 0; nItemNum < nNumItems; ++nItemNum)
{
lvi.iItem = nItemNum;
ListView_GetItem(hwndFileList, &lvi);
FILE_ITEM_INFO* pFileItemInfo = (FILE_ITEM_INFO*)lvi.lParam;
delete[] (PBYTE)pFileItemInfo;
}
CloseViewPane(hwnd);
g_Splitter.Detach();
}
/**
* @brief Dialog procedure of Preview dialog.
* @param hwndDlg - window handle.
* @param uMsg - message identifier.
* @param wParam - 1st message parameter.
* @param lParam - 2nd message parameter.
* @return message result.
*/
INT_PTR CALLBACK PreviewDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
HANDLE_MSG(hwndDlg, WM_INITDIALOG, PreviewDlg_OnInitDialog);
HANDLE_MSG(hwndDlg, WM_COMMAND, PreviewDlg_OnCommand);
HANDLE_MSG(hwndDlg, WM_SIZE, PreviewDlg_OnSize);
HANDLE_MSG(hwndDlg, WM_GETMINMAXINFO, PreviewDlg_OnGetMinMaxInfo);
HANDLE_MSG(hwndDlg, WM_DESTROY, PreviewDlg_OnDestroy);
HANDLE_MSG(hwndDlg, WM_NOTIFY, PreviewDlg_OnNotify);
default: return FALSE;
}
}
/** @} */
|
bchavez/BugTrap
|
source/Client/PreviewDlg.cpp
|
C++
|
mit
| 19,721
|
/*
* contract.h
*
* Created on: Apr 12, 2014
* Author: wilfeli
*/
#ifndef CONTRACT_H_
#define CONTRACT_H_
#include "Asset.h"
#include "PaymentSystem.h"
class IBuyerL;
class ISellerL;
class IPSAgent;
//template<typename Ti, typename Th> class Contract: public Asset<Th>{
//// auto holder;
//// auto issuer;
//public:
//
// Contract(Ti*, Th*);
// Ti* issuer;
//
//
//};
//
//
//class ContractHK: public Contract<ISellerL, IBuyerL>{
//public:
// ContractHK(ISellerL*, IBuyerL*,
// double, double,
// int, int);
//
// double p;
// int t_begin;
// int t_end;
//// ISellerL* issuer;
//// IBuyerL* holder;
//
//// double q;
//// std::string type = "asCHK";
//
//
//
//};
//
//
//class ContractBDt0: public Contract<IPSAgent, IPSAgent>{
//public:
// ContractBDt0(IPSAgent*, IPSAgent*, double);
//};
class ContractHK{
public:
ContractHK(ISellerL*, IBuyerL*,
double, double,
int, int);
double p;
int t_begin;
int t_end;
ISellerL* issuer;
IBuyerL* holder;
double q;
std::string type;
};
class ContractBDt0{
public:
ContractBDt0(IPSAgent*, IPSAgent*, double);
IPSAgent* issuer;
IPSAgent* holder;
double q;
std::string type;
};
#endif /* CONTRACT_H_ */
|
wilfeli/DMGameBasic
|
src/Contract.h
|
C
|
mit
| 1,194
|
# urgot
Projeto teste desenvolvido com o intuito de desenvolver minhas habilidades com o Angularjs, Gulpjs e Nodejs. Seu objetivo principal é exibir imagens com marcações.
Atenção: este projeto esta parado devido a falta de tempo.
|
geanpeixoto/urgot
|
README.md
|
Markdown
|
mit
| 239
|
package com.wizzardo.http.http2;
/**
* Created by wizzardo on 27.07.15.
*/
public class Frame {
public enum Type {
DATA(0),
HEADERS(1),
PRIORITY(2),
RST_STREAM(3),
SETTINGS(4),
PUSH_PROMISE(5),
PING(6),
GOAWAY(7),
WINDOW_UPDATE(8),
CONTINUATION(9);
public final int value;
Type(int value) {
this.value = value;
}
}
private static final int HEADER_LENGTH = 9;
private static final int MAX_LENGTH = 1 << 14;
private final int offset;
private final int length;
protected byte[] data;
public Frame(byte[] data) {
this(data, 0, data.length);
}
public Frame(byte[] data, int offset, int length) {
if (length >= MAX_LENGTH)
throw new IllegalArgumentException("length >= MAX_LENGTH");
byte[] bytes = new byte[HEADER_LENGTH + length];
System.arraycopy(data, offset, bytes, HEADER_LENGTH, length);
this.data = bytes;
this.offset = HEADER_LENGTH;
this.length = length;
data[2] = (byte) length;
data[1] = (byte) ((length >> 8) & 0x3f); //14 bit length - max
}
public Frame type(int type) {
data[3] = (byte) type;
return this;
}
public Frame type(Type type) {
return type(type.value);
}
public Frame flag(int flag) {
data[4] = (byte) flag;
return this;
}
public Frame streamId(int id) {
data[5] = (byte) ((id >> 24) & 0x7f);
data[6] = (byte) (id >> 16);
data[7] = (byte) (id >> 8);
data[8] = (byte) id;
return this;
}
}
|
wizzardo/http
|
src/main/java/com/wizzardo/http/http2/Frame.java
|
Java
|
mit
| 1,680
|
/**
* @param {number} c
* @return {boolean}
*/
const judgeSquareSum = function (c) {
for (let i = 0; i <= Math.sqrt(c / 2); ++i) {
let x = c - i * i;
let sqrtX = Math.sqrt(x);
if (sqrtX === Math.floor(sqrtX)) {
return true;
}
}
return false;
};
module.exports = judgeSquareSum;
|
alenny/leetcode
|
src/sum-of-square-numbers/index.js
|
JavaScript
|
mit
| 337
|
import * as React from 'react'
import * as css from './styles.scss'
import { Classes } from 'helpers'
export interface P {
name?: string;
type?: 'button' | 'checkbox' | 'file' | 'hidden' | 'password' | 'radio' | 'text';
label?: string;
value?: string | number;
focus?: boolean;
integer?: boolean;
floating?: boolean;
clearable?: boolean;
placeholder?: string;
className: string;
wrapperClassName: string;
handleBlur?: (value: string) => void | boolean;
handleFocus?: (e: Event) => void | boolean;
handleChange?: (e: Event) => void | boolean;
handleKeyPress?: (keyCode: number) => void | boolean;
}
export interface S {
value?: string | number;
}
const cx = Classes.bind(css)
export default class SimpleInput extends React.Component<P, S> {
static defaultProps = {
type: 'text',
label: '',
value: '',
focus: false,
integer: false,
floating: false,
clearable: false,
}
static getDerivedStateFromProps (props: P, state: S) {
if (state.value !== props.value) {
return {
value: props.value,
touch: false,
}
}
return {
touch: false,
}
}
state = {
value: '',
}
input: any = React.createRef()
componentDidMount () {
if (this.props.focus) {
this.input.current.focus()
}
}
prepared = (value: string) => {
const { integer, floating } = this.props
if (integer) {
return parseInt(value, 10)
} else if (floating) {
return parseFloat(value)
}
return value
}
handleClear = () => {
this.setState((state: S) => ({
...state, value: '',
}), () => {
if (this.props.handleChange) {
this.props.handleChange('')
}
})
}
handleChange = (e: any) => {
const value = this.prepared(e.target.value)
this.setState((state: S) => ({
...state, value,
}), () => {
if (this.props.handleChange) {
this.props.handleChange(value)
}
})
}
handleFocus = (e: any) => {
if (this.props.handleFocus) {
this.props.handleFocus(e)
}
}
handleBlur = (e: any) => {
const value = this.prepared(e.target.value)
if (this.props.handleBlur) {
this.props.handleBlur(value)
}
}
handleKeyPress = (e: any) => {
const keyCode = e.keyCode || e.charCode || e.which
if (this.props.handleKeyPress) {
this.props.handleKeyPress(keyCode)
}
}
render () {
const { value } = this.state
const { label, clearable, placeholder, wrapperClassName, className } = this.props
return (
<label className={cx({ wrapper: true }, wrapperClassName)}>
{label &&
<div className={cx(css.label)}>{label}</div>
}
<input
ref={this.input}
value={value}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
onChange={this.handleChange}
onKeyPress={this.handleKeyPress}
placeholder={placeholder}
className={cx(css.control, css.controlInput, className)}
/>
{value && clearable &&
<button type="button" onClick={this.handleClear} className={css.cleaner} />
}
</label>
)
}
}
|
lnked/react-starter
|
src/components/simple-input/index.tsx
|
TypeScript
|
mit
| 3,214
|
export default {
dialPlaceholder: "Name oder Nr. eingeben"
};
// @key: @#@"dialPlaceholder"@#@ @source: @#@"Enter Name or Number"@#@
|
ringcentral/ringcentral-js-widget
|
packages/ringcentral-widgets/components/Rcui/RecipientsInput/i18n/de-DE.js
|
JavaScript
|
mit
| 136
|
<?php
/*
* This file is part of the Presque package.
*
* (c) Justin Rainbow <justin.rainbow@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Presque\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Command\Command;
use Presque\Job;
class WorkerCommand extends Command
{
/**
* {@inheritDoc}
*/
protected function configure()
{
$this
->setName('worker')
->setDescription('Starts a new Presque worker')
->setDefinition(array(
))
->setHelp(<<<EOT
The <info>%command.name%</info> command starts a new Presque worker
<info>%command.full_name%</info> queue [job] [args]
EOT
);
}
/**
* {@inheritDoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
}
}
|
justinrainbow/presque
|
src/Presque/Command/WorkerCommand.php
|
PHP
|
mit
| 1,131
|
class Dorsale::UsersController < ::Dorsale::ApplicationController
before_action :set_objects, only: [
:show,
:edit,
:update,
]
def index
authorize User, :list?
@users ||= scope.all.order(is_active: :desc)
end
def new
@user ||= scope.new
authorize @user, :create?
end
def create
@user ||= scope.new(user_params_for_create)
authorize @user, :create?
if @user.save
flash[:notice] = t("messages.users.create_ok")
redirect_to dorsale.users_path
else
flash.now[:error] = t("messages.users.create_error")
render :new
end
end
def show
end
def edit
authorize @user, :update?
end
def update
authorize @user, :update?
if @user.update(user_params_for_update)
flash[:notice] = t("messages.users.update_ok")
redirect_to dorsale.users_path
else
flash.now[:error] = t("messages.users.update_error")
render :edit
end
end
private
def model
User
end
def set_objects
@user = scope.find(params[:id])
end
def permitted_params
[
:email,
:password,
:password_confirmation,
:is_active,
:avatar,
]
end
def user_params
params.fetch(:user, {}).permit(permitted_params)
end
def user_params_for_create
user_params
end
def user_params_for_update
user_params
end
end
|
agilidee/dorsale
|
app/controllers/dorsale/users_controller.rb
|
Ruby
|
mit
| 1,381
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.4
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
using System;
using System.Runtime.InteropServices;
namespace Noesis
{
public class Setter : SetterBase {
internal new static Setter CreateProxy(IntPtr cPtr, bool cMemoryOwn) {
return new Setter(cPtr, cMemoryOwn);
}
internal Setter(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) {
}
internal static HandleRef getCPtr(Setter obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
public Setter() {
}
protected override System.IntPtr CreateCPtr(System.Type type, out bool registerExtend) {
registerExtend = false;
return NoesisGUI_PINVOKE.new_Setter();
}
public string TargetName {
set {
NoesisGUI_PINVOKE.Setter_TargetName_set(swigCPtr, value != null ? value : string.Empty);
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
}
get {
IntPtr strPtr = NoesisGUI_PINVOKE.Setter_TargetName_get(swigCPtr);
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
string str = Noesis.Extend.StringFromNativeUtf8(strPtr);
return str;
}
}
public DependencyProperty Property {
set {
NoesisGUI_PINVOKE.Setter_Property_set(swigCPtr, DependencyProperty.getCPtr(value));
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
}
get {
IntPtr cPtr = NoesisGUI_PINVOKE.Setter_Property_get(swigCPtr);
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
return (DependencyProperty)Noesis.Extend.GetProxy(cPtr, false);
}
}
public object Value {
set {
NoesisGUI_PINVOKE.Setter_Value_set(swigCPtr, Noesis.Extend.GetInstanceHandle(value));
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
}
get {
IntPtr cPtr = NoesisGUI_PINVOKE.Setter_Value_get(swigCPtr);
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
return Noesis.Extend.GetProxy(cPtr, false);
}
}
new internal static IntPtr GetStaticType() {
IntPtr ret = NoesisGUI_PINVOKE.Setter_GetStaticType();
#if UNITY_EDITOR || NOESIS_API
if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve();
#endif
return ret;
}
}
}
|
JinkiJung/PAUT
|
VRAT/vrat/Assets/Plugins/NoesisGUI/Scripts/Proxies/Setter.cs
|
C#
|
mit
| 3,175
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.